将文本框文本添加到网格中 [英] adding the textbox text to grid

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

问题描述

我有一个网格..





格外我有一个文本框并添加按钮......



现在当我添加按钮时,文本框中的文本应该添加到网格中...





请帮助

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

推荐答案

  1. OnClick 事件附加到按钮
  2. 内部 OnClick 事件,获取 TextBox 文字by txtYourTextBoxID.Text
  3. 更新 GridView <的 DataSource / code>添加一个新行。如果您使用 DataTable ,请为该 DataTable DataRow c>。
  4. DataTable 分配给 GridView DataSource
  5. 绑定 GridView
  1. Attach a OnClick Event to the Button.
  2. Inside OnClick Event, get the TextBox Text by txtYourTextBoxID.Text.
  3. Update the DataSource of GridView by adding a new Row. If you are using DataTable, create a new DataRow for that DataTable.
  4. Assign the DataTable to GridView DataSource.
  5. Bind the GridView.


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

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