Thank you for your help.
I tried to do it with GridView but I couldn't, (I am a newbie)
For example, say I want to assign a label the value in the gridview
that has been selected. I tried
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
GridView1.SelectedIndexChanged
Label1.Text = GridView1.SelectedRow.Cells(0).ToString
End Sub
when I select a row Label1 is assigned the value:
"System.Web.UI.WebControls.DataControlFieldCel l"
actually I want to assign the value in the selected row to an imageURL.
as far as I know GridView should be able to do it. but I couldnt get it
done.
thanks again for your help...
sweet_dreams wrote:
Dot Net Daddy napisal(a):
Hello,
I want to create label and checkbox for every member in the database
table.
How can I do that?
I tried:
Dim x as integer
For Each x In ds.Tables(0).Rows.Count
.... code here
Next
But it didnt work, giving an error:
Error 1 Expression is of type 'Integer', which is not a collection
type.
also how can I code creating a new checkbox and label for every x
in the table?
Hi,
First of all, you use For Each ... In ... to iterate through a
collection of items. In your code x's type should be DataRow and you
should interate through collection of rows like that:
dim x as DataRow
For Each x In ds.Tables(0).Rows
...
Next
or
Dim RowNumber as Integer=ds.Tables(0).Rows.Count
for i as integer=1 to RowNumber
...
Next
Secondly, I don't think creating many Labels and checkboxes is good
idea. If you want to show data from dataset it's beter to use GridView.
You can have there for example CheckBox field.
regards,
sweet_dreams