Click here to Skip to main content
15,888,301 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I'm having a gridview in modalpopupextender and in that gridview there is a textbox. I'm trying to get that textbox value to insert in database, I'm able to get the control but when I'm trying to get text its returning nul. Can anyone please help me with this. I'll really appreciate that.
Thanks in advance :)

Here is part of my code....


VB
Protected Sub gridView_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gridview.RowCommand
        Dim I As Integer = Int32.Parse(e.CommandArgument)
        Dim row As GridViewRow = gridView.Rows(I)
        Dim txt As New TextBox
        txt = CType(row.FindControl("textbox"), TextBox)
        Dim Comment As String = txt.Text.ToString()
        Response.Write(Comment)
        RaiseEvent EventName(sender, e, Comment)
    End Sub



Here "comment" is coming "empty string" always
Posted

1 solution

try like this...

VB
Protected Sub gridView_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gridview.RowCommand
        
        Dim gdvRow as GridViewRow = e.CommandSource.Parent.Parent
        Dim txt As New TextBox
        txt = CType(gdvRow.FindControl("textbox"), TextBox)
        Dim Comment As String = txt.Text.ToString()
        Response.Write(Comment)
        RaiseEvent EventName(sender, e, Comment)
    End Sub


hope this works...
 
Share this answer
 
Comments
bony909 30-Nov-11 9:06am    
Thanks a lot for reply but it didn't work, still textbox value is coming empty string.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900