Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim sqlsize, a, b, c As String Dim rowcount As String rowcount = GridView1.Rows.Count ' If rowcount > 0 Or rowcount < 21 Then ' Dim rowIndex As Integer For rowIndex As Integer = 0 To rowcount - 1 'rownumber = GridView1.Rows(rowIndex).Cells(0).Text Dim LabelL As Label = GridView1.Rows(rowIndex).Cells(1).FindControl("LabelID1") Dim row As GridViewRow = GridView1.SelectedRow Dim ddl1 As DropDownList = GridView1.Rows(rowIndex).Cells(3).FindControl("ddlSizeG") 'Dim ddl As DropDownList = DirectCast(sender, DropDownList) 'Dim gRow__1 As GridViewRow = DirectCast(ddl.NamingContainer, GridViewRow) 'Dim myGrid As GridView = DirectCast(gRow__1.NamingContainer, GridView) 'myGrid.SelectedIndex = gRow__1.RowIndex sqlsize = "select size_length, size_width ,size_height from mpc_product_size where size_code = '" & ddl1.SelectedValue & "'" db.OpenTableMPC(sqlsize) If Not db.Eof Then 'If ddlSize.SelectedValue = "NA" Then a = db.Item("size_length") Dim txtL As TextBox = GridView1.Rows(rowIndex).Cells(4).FindControl("txtL") txtL.Text = FormatNumber(CDbl(a), "0") b = db.Item("size_width") Dim txtw As TextBox = GridView1.Rows(rowIndex).Cells(5).FindControl("txtW") txtw.Text = FormatNumber(CDbl(b), "0") c = db.Item("size_height") Dim txth As TextBox = GridView1.Rows(rowIndex).Cells(6).FindControl("txtH") txth.Text = FormatNumber(CDbl(c), "0") If ddl1.SelectedValue = "NA" Then txtL.ReadOnly = False txtw.ReadOnly = False txth.ReadOnly = False Else ddl1.Focus() txtL.ReadOnly = True txtw.ReadOnly = True txth.ReadOnly = False End If End If db.MoveNext() If db.Eof Then Exit For End If Next End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)