Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListBox and Checkbox always False

Status
Not open for further replies.

mreverman

Programmer
Dec 5, 2002
4
US
I have an index.aspx file that calls several user controls that I created. They are named as follow:



<%@ Register tagPrefix="myCtrls" tagName="logo" Src="LogoTemplate.ascx" %>

<%@ Register tagPrefix="myCtrls" tagName="menuSearchTemplate" Src="MenuSearchTemplate.ascx" %>

<%@ Register tagPrefix="myCtrls" tagName="footer" Src="FooterTemplate.ascx" %>

<%@ Register tagPrefix="myCtrls" tagName="transaction" Src="TransctnActvty.ascx" %>



I am working with the TransctnActvty.ascx code behind file (TransctnActvty.ascx.vb) to read the values of the listboxes and checkboxes for true values.

The CheckBox is located with a reapeater because I need the user to select multiple entries located with the <ItemTemplate> tag. The problem is that even though they are checked they are always evaluating to FALSE values.



The ListBox is not within the repeater.



The repeater id is

<asp:Repeater ID="Repeater1" Runat="server">



The ListBox id is

<asp:ListBox Runat="server" ID="lbxEventType" DataValueField="EventTypeDescr" SelectionMode="Multiple"></asp:ListBox>



The CheckBox is is

<asp:CheckBox ID="SendThis" Checked="False" OnClick="javascript: return select_deselectAll (this,this.checked, this.id);" runat="server"/></asp:CheckBox>





Here is the command buttons code that is located in the TransctnActvty.ascx.vb



ResndAudit and ResndRecrd are classes that I developed.

The for loops do get the total count of each but it doesn’t recognize the (Checked and Selected for each)



Public Sub ResendData(ByVal sender As Object, ByVal e As System.EventArgs)

Dim rc As RepeaterItemCollection = Repeater1.Items

Dim isChecked, isChecked2 As Boolean

Dim success, i As Int32

Dim MyResndAudit As New ResndAudit

Dim MyResndRecrd As New ResndRecrd



success = MyResndAudit.updateResndAudit(tbxComment.Text, "Scheduled", lblUsername.Text, lblUsername.Text, lblUsername.Text)

For i = 0 To rc.Count - 1

Dim CurrentCheckBox As CheckBox = CType(Repeater1.Items(i).FindControl("SendThis"), CheckBox)

test.Text = CType(Repeater1.Items(i).FindControl("MsgText"), Label).Text

If CurrentCheckBox.Checked Then

End If

Next i

For i = 0 To lbxEventType.Items.Count - 1

'isChecked = lbxEventType.Items(i).Selected

'test.Text = i.ToString & " " & lbxEventType.Items(i).Selected.ToString & " " & test.Text

If isChecked Then

'MyResndRecrd.updateResndRecrd(MyResndAudit.intResendAuditID, lbxEventType.Items(i).Value, CType(dl.FindControl("MsgText"), Label).Text, "Y", lblUsername.Text, lblUsername.Text)

End If

Next i

End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top