如何获取modalpopupextender中的文本框(在gridview中)的值 [英] How to get value of a textbox(in gridview) that is in modalpopupextender

查看:67
本文介绍了如何获取modalpopupextender中的文本框(在gridview中)的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在modalpopupextender中有一个gridview,在那个gridview中有一个文本框.我试图获取要在数据库中插入的文本框值,但能够获得控件,但是当我尝试获取文本时,返回nul.谁能帮我这个忙.我会很感激的.
在此先感谢:)

这是我的代码的一部分....


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....


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




这里的"comment"总是空字符串",总是




Here "comment" is coming "empty string" always

推荐答案

像这样尝试...

try like this...

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...


这篇关于如何获取modalpopupextender中的文本框(在gridview中)的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆