Larry Brister
asked on
Append Collection
The attached spipped gets items checked in my RadListBok and appends or refreshes my label.
However...it is DOUBLE appending the items...and without the seperating comma
However...it is DOUBLE appending the items...and without the seperating comma
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
getFIPS(RadListBox1, itemsFips, ckAppend)
End Sub
Private Shared Sub getFIPS(ByVal listBox As RadListBox, ByVal label As Label, ByVal ckAppend As CheckBox)
Dim sb As New StringBuilder()
Dim collection As IList(Of RadListBoxItem) = listBox.CheckedItems
For Each item As RadListBoxItem In collection
sb.Append(item.Value & ",")
Next
If ckAppend.Checked = True Then
label.Text = label.Text & sb.ToString().Substring(0, sb.ToString().Length - 1)
Else
label.Text = sb.ToString().Substring(0, sb.ToString().Length - 1)
End If
End Sub
ASKER
nomoose:
If I take out the logic for the checkbox and simply have the code below it over writes every time.
blah..blah..blah..
label.Text = sb.ToString().Substring(0, sb.ToString().Length - 1)
End Sub
I want it to do that IF the checkbox is NOT checked, but append the new information if it is.
The actual button that calls the Button1_Click is:
<asp:Button ID="Button1" runat="server" CssClass="ButtonSmall" OnClick="Button1_Click" Text="Get Selected Items!" />
If I take out the logic for the checkbox and simply have the code below it over writes every time.
blah..blah..blah..
label.Text = sb.ToString().Substring(0,
End Sub
I want it to do that IF the checkbox is NOT checked, but append the new information if it is.
The actual button that calls the Button1_Click is:
<asp:Button ID="Button1" runat="server" CssClass="ButtonSmall" OnClick="Button1_Click" Text="Get Selected Items!" />
I'm not sure if this will fix the problem entirely, but try the following things in the order stated because one will resolve the others...
1) In visual studio next to the play (a green arrow) button in the debug toolbar it has a dropdown. Make sure that dropdown is set to "Debug" If it's set to release the debug files for the site won't be created or updated.
2) In your web.config file there is a line in the <system.web> tag that says "compilation debug". Make sure that looks like this:
<compilation debug="true">
3) Another thing you can try is right clicking on the solution in visual studio and click "property pages." In that window go to "Start Options" and under "Debuggers" make sure "ASP.NET" is checked off.
If those don't work I can dig around and try to think of more creative ways to get the debugger to do what it's supposed to.
1) In visual studio next to the play (a green arrow) button in the debug toolbar it has a dropdown. Make sure that dropdown is set to "Debug" If it's set to release the debug files for the site won't be created or updated.
2) In your web.config file there is a line in the <system.web> tag that says "compilation debug". Make sure that looks like this:
<compilation debug="true">
3) Another thing you can try is right clicking on the solution in visual studio and click "property pages." In that window go to "Start Options" and under "Debuggers" make sure "ASP.NET" is checked off.
If those don't work I can dig around and try to think of more creative ways to get the debugger to do what it's supposed to.
Disregard the above post, EE and Google Chrome do not play well together. For some reason it was posting my responses to all the other posts I had visited.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If this isn't the case is the label being touched anywhere else in the code?