visweswaran28 0 Light Poster

Hi,

I have datagrid control. In that I place textbox, insert link button in hearder template. When I click that Insert button the value from textbox should be loaded into grid. I am capturing at rowcommand()

here the code:

If e.CommandName = "Insert" Then
Dim t1 As TextBox
t1 = CType(e.Item.FindControl("phasetxt"), TextBox)
Dim t2 As TextBox
t2 = CType(e.Item.FindControl("phasevaltxt"), TextBox)
Dim ii As Integer
objt = Session("dt")
Dim fg As Boolean = True
For ii = 0 To objt.Rows.Count - 1
If objt.Rows(ii).Item("phase_desc") = t1.Text.Trim Then
fg = False
End If
Next
If fg = True Then
Dim nrow As DataRow
nrow = objt.NewRow
nrow("phase_desc") = t1.Text.Trim
nrow("phase_value") = t2.Text
objt.Rows.Add(nrow)
objt.AcceptChanges()
Session("dt") = objt
grdData.DataSource = objt
grdData.DataBind()
Else
Dim strretval As String
strretval = "window.alert('Phase Description Already Added');"
Page.ClientScript.RegisterStartupScript(Me.GetType(), "passval", strretval, True)
End If
End If

but when I retriving textbox value it always give empty value only. how can I achieve this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.