Click to See Complete Forum and Search --> : Not to read data in tableheaderrow


capik79
07-04-2006, 09:06 AM
Hi guys,

I create a program to get input from each row. But it also read data from tableheaderrow. Nad it return and error because it will return no input when i use FindControl and assign it to other variable. How to prevent this from happened. I very new to .Net pls suggest me a solution fot it. here the code sample

Dim dr As TableRow
Dim i As Integer = 1
Dim smatId, sfName, sPartno As String
smatId = Session("sMatNo")
sfName = Session("sItem")
sPartno = Session("sPartNo")

For Each dr In Table1.Rows




Dim txtPartNoAlt As TextBox = dr.FindControl("txtPartNoAlt" & i)
Dim txtDescAlt As TextBox = dr.FindControl("txtDescAlt" & i)
Dim txtUsageAlt As TextBox = dr.FindControl("txtUsageAlt" & i)
Dim sValue1, sValue2, sValue3 As String
sValue1 = txtPartNoAlt.Text '( error will happened when come to this)
sValue2 = txtDescAlt.Text
sValue3 = txtUsageAlt.Text

i = i + 1


Next

Regards
Shaffiq

AlecW
07-05-2006, 04:42 PM
Why are you using for each? Try using a for loop instead and skip over the first row entirely. Also, what exactly is you are trying to do? Would it not be better to get this from the datatable?