网格视图中文本框的访问值 [英] access value of a textbox in grid view

查看:74
本文介绍了网格视图中文本框的访问值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网格视图
在我的网格视图中有3列
1:产品ID
2:文本框
3:按钮
我想单击按钮添加到产品计数字段中
附加值是textbox.text

i have a grid view
in my grid view is 3 columns
1 :product id
2:textbox
3:button
i want add to product count field with click on the button
added value is textbox.text
how i can access textbox.text with click on the button of that row?

推荐答案

向按钮Button1_Click添加一个事件,然后在该click事件中(气泡事件) )您可以找到控件

Add an event to the button Button1_Click then in that click event (bubble event) you can find the control

protected void Button1_Click(object sender, EventArgs e)
{
GridViewRow row=((Button)sender).Parent.Parent as GridViewRow;
TextBox t=(TextBox)row.FindControl("textbox ");
//t.Text - here is your value
}


这篇关于网格视图中文本框的访问值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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