将文本框文本添加到网格中 [英] adding the textbox text to grid
本文介绍了将文本框文本添加到网格中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网格..
格外我有一个文本框并添加按钮......
现在当我添加按钮时,文本框中的文本应该添加到网格中...
请帮助
i had a grid..
outside of grid i had a textbox and add button...
now whenevr i clcik on add button the text in the textbox should add in to grid...
please help
推荐答案
- 将
OnClick
事件附加到按钮。 - 内部
OnClick
事件,获取TextBox
文字bytxtYourTextBoxID.Text
。 - 更新
GridView <的
DataSource
/ code>添加一个新行。如果您使用DataTable
,请为该DataTable $ c $创建一个新的
DataRow
c>。 - 将
DataTable
分配给GridView
DataSource
。 - 绑定
GridView
。
- Attach a
OnClick
Event to the Button. - Inside
OnClick
Event, get theTextBox
Text bytxtYourTextBoxID.Text
. - Update the
DataSource
ofGridView
by adding a new Row. If you are usingDataTable
, create a newDataRow
for thatDataTable
. - Assign the
DataTable
toGridView
DataSource
. - Bind the
GridView
.
这篇关于将文本框文本添加到网格中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文