how to retrieve value of label from datalist

Dear all, I have a datalist with one label and one checkbox in it. I want to check(once the button is clicked) whether the checkbox is checked and if it''s checked print the label value. The code of datalist is as follows.. ''> '' Visible="False"> Thanks Meera

1 Reply

MS Mark S. October 12, 2005 02:23 PM UTC

If you have this running as a server control, you can declare a checkbox or label and then cycle through them all in a loop and if they are checked then take some action: Dim CurrentCheckBox As CheckBox For i = 0 To datalist.Items.Count - 1 CurrentCheckBox = datalist.Item(i).FindControl("checkbox") If CurrentCheckBox.Checked = False Then ''do something here End if Loop where checkbox is the id for the control. Works the same for Label, just declare a label Dim CurrentLabel as Label CurrentLabel=datalist.Item(i).FindControl("label") Hope this helps. Remove the spams to email me. Mark

Loader.
Up arrow icon