使用usercontrol在gridview中更新 [英] update in gridview using usercontrol

查看:78
本文介绍了使用usercontrol在gridview中更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用usercontrol更新gridview.我有gridview和一个usercontrol.
当我在gridvew中单击编辑"时,用户控件应弹出.在这里我有一个疑问,我该如何访问usercontrol文本框中的gridview行数据.

请帮助我

谢谢.

I want to update gridview using usercontrol. i have gridview and one usercontrol.
when i click on edit in gridvew usercontrol should popup. here i have one doubt how can i access gridview row data in usercontrol textbox.

please help me

thank you.

推荐答案

在Gridview上选定的索引已更改,您可以获取当前行并将其设置为用户控制文本框,如下所示:

On Gridview selected index changed, you can get the current row and set it to user control text box as:

protected void GridView1_SelectedIndexChanged(object sender,
EventArgs e)
{
// Get the currently selected row using the SelectedRow property.
GridViewRow row = GridView1.SelectedRow;

// Set usercontrol text box text property
userControl1.TextBox.Text = row.Cells[1].Text;
}


这篇关于使用usercontrol在gridview中更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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