如何从子窗体的数据网格填充文本框 [英] How to fill the text boxes from the data grid of child form

查看:128
本文介绍了如何从子窗体的数据网格填充文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个Web表单,其中我在网格视图中显示数据.
我的要求是,如果任何人想要更改gridview的任何字段,只需单击该字段,父窗体的文本框就会填充完整的数据.

请帮助我如何做到这一点.

I have developed one webform in which i m displaying the data in grid view.
My Requirement is that if any one wants to change any of the fields of the gridview,just click on that field and the text boxes of the parent form gets populated with the complete data.

Please help me how i can do this.

推荐答案

使用网格视图的Item Templete并将2个控件(1)LinkBut​​ton(2)文本框放在单个itemTemplete内.

->使textBox可见false(默认).

->在linkbutton的单击事件上,使文本框可见为true,而linkbutton可见为false.然后将linkbutton的文本放入文本框.

->在textChange事件上,使文本框可见,为false,而linkbutton可见,为true,然后将textBox文本放入linkbutton文本.

结束....
拜拜.
Use Item Templete of grid view and put 2 controls (1)LinkButton (2)Text Box Inside a single itemTemplete.

--> make the textBox visible false (default).

--> On click event of linkbutton make textbox visible true and linkbutton visible false.And put the text of linkbutton to textbox.

--> On textChange event make the textbox visible false and linkbutton visible true and put the textBox text to linkbutton text.


Over....
Byyyy.


大概是父"表单创建并显示了第二个表单.如果正确,那么父窗体应该在显示第二个窗体之前先订阅第二个窗体的单元格单击事件.
Presumably the Parent form creates and shows the second form. If that is correct then the Parent form should subscribe to the cell click event of the second form, before showing it.


使用事件(自定义),创建您自己的事件,并向cellclick事件或所需事件,请使用从Eventargs类派生的自定义类,然后将要发送给父对象的数据传递给该类的对象.
use events (custom), create your own event, register it with the cellclick event or the event you want , use custom class derived from Eventargs class and pass the data you want to send to the parent trough an object of that class.


这篇关于如何从子窗体的数据网格填充文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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