在网格视图的行中添加文本框 [英] add textbox in row of grid view

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

问题描述

我有一个网格视图来显示数据库中的所有记录。现在我需要一个搜索框。所需的设计是这样的。



名称|地址|联系



所有记录都以网格显示。第一行显示列标题,第二行显示数据库中的记录..现在我想在第二行(即在各自的列标题下面)中的文本框和第三行中的数据库记录。如果用户在列标题名称下方的文本框中输入名称。必须根据名称进行搜索..我在.aspx页面中使用标题模板标签尝试了几个标签,但无法获得所需的输出。任何帮助???

i have a grid view to display all the records from database.. Now I require a search box. the required design goes like this.

Name | Address | Contact

All the records are displayed in grid. first row displayed the column header and second row displays record from database.. now i want a text boxes in second row (i.e. below respective column header) and record from database in 3rd row. If user enters the name in textbox below column header name. the search must be done based on the name.. I had tried few tags in .aspx page using header template tag but could not get desired output. Any help???

推荐答案

点击网格的行事件,你可以添加这样的代码来创建一个textxbox。



on click of row event of grid you can add code like this to create a textxbox.

protected void grd_RowEditing(object sender, GridViewEditEventArgs e) 
{
     GridViewRow selectRow = grd.Rows(e.NewEditIndex);
     TextBox txtKj=(TextBox)selectRow.Cells[3].FindControl("txtKjId"); 
}





希望这个帮助。

-SG



Hope this help.
-SG


您可以在下面的链接中尝试一些能够完全满足您的搜索需求的内容(内联Gridview搜索功能)



在GridView的标题中集成内联搜索 [ ^ ]



希望这有帮助







添加链接文字以反映文章标题。

[/编辑]
You can try something in the below link which takes care of your search need exactly ( inline Gridview search feature )

Integrating Inline Search in a GridView's Header[^]

Hope this helps



Link text added to reflect the article title.
[/Edit]


访问这里...





在现有gr的每一行中插入文本框idview [ ^ ]
visit here...


Insert text box in each row of an existing gridview[^]


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

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