Select to view content in your preferred language

information window showing information in a single line

685
3
09-22-2013 05:29 AM
JulieBiju
Deactivated User
Dear Ones ,

Advance thanks to all..In my web application information window is coming nicely(see the image) with the code I attached here with.
[ATTACH=CONFIG]27661[/ATTACH]

 Dim strhotspot As String = ""
            strhotspot = "VEHICLE: " & Trim(TryCast(CmbFahrname.SelectedItem, comboloadclass).ename.ToString()) & ", DATETIME: " & Trim(TxtLastUpd.Text) & ", LOCATION:" & location & ", SPEED: " & e.Result(recordcount).Espeed & ", STATUS: " & Status
            graphic.Attributes.Add("STRHOTSPOT", strhotspot)

 <esri:InfoWindow x:Name="MyInfoWindow"
                         Padding="2"
                         CornerRadius="10"                        
                         Map="{Binding ElementName=MyMap}" 
            ContentTemplate="{StaticResource MyGrLayerInfoWindowTemplate}">
                     <esri:InfoWindow.Background>
                <LinearGradientBrush EndPoint="1.038,1.136" StartPoint="0.015,0.188">
                    <GradientStop Color="#FFD1DFF2"/>
                    <GradientStop Color="#FF666666" Offset="0.946"/>
                </LinearGradientBrush>
            </esri:InfoWindow.Background>
        </esri:InfoWindow>


Now the requirement is I wanted to show the information like the link below.In this information is showing line by line.HOW CAN i Do THIS??

I need to show the information like line by line like

vehicle:------
DATETIME:-------


http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#WebMapDynamicServicePopups
0 Kudos
3 Replies
JohanCarlsson
Regular Contributor
To insert a new line in a string, try using \n where you want the line break.
Your string would look like this:

strhotspot = "VEHICLE: " & Trim(TryCast(CmbFahrname.SelectedItem, comboloadclass).ename.ToString()) & "\nDATETIME: " & Trim(TxtLastUpd.Text) & "\nLOCATION:" & location & "\nSPEED: " & e.Result(recordcount).Espeed & "\nSTATUS: " & Status
            graphic.Attributes.Add("STRHOTSPOT", strhotspot)
0 Kudos
JulieBiju
Deactivated User
To insert a new line in a string, try using \n where you want the line break. 
Your string would look like this: 

strhotspot = "VEHICLE: " & Trim(TryCast(CmbFahrname.SelectedItem, comboloadclass).ename.ToString()) & "\nDATETIME: " & Trim(TxtLastUpd.Text) & "\nLOCATION:" & location & "\nSPEED: " & e.Result(recordcount).Espeed & "\nSTATUS: " & Status
            graphic.Attributes.Add("STRHOTSPOT", strhotspot)


I tried the way u mentioned like below...But not working...Pls help me

strhotspot = "VEHICLE: " & Trim(TryCast(cn.SelectedItem, comboloadclass).ename.ToString()) & "\nDATETIME: "
0 Kudos
LanceCrumbliss
Frequent Contributor
You're using VB.  Try

 Dim strhotspot As String = ""
            strhotspot = "VEHICLE: " & Trim(TryCast(CmbFahrname.SelectedItem, comboloadclass).ename.ToString()) & VbCrLf & "DATETIME: " & Trim(TxtLastUpd.Text) & VbCrLf & "LOCATION:" & location & VbCrLf & "SPEED: " & e.Result(recordcount).Espeed & VbCrLf & "STATUS: " & Status
            graphic.Attributes.Add("STRHOTSPOT", strhotspot)
0 Kudos