我可以在gridview的同一行中使用boundfield和textbox [英] Can i have boundfield and textbox in the same row of a gridview
问题描述
我有一个asp.net网页,我在其中选择学校的特定班级和部门。基于这些值,gridview将加载该类中的学生名称(存储在sql server db中的student表中)。如果我想一次性使用此gridview(批量条目)为每个学生分配测试标记,那么该怎么做。 (我的想法是,第一列作为学生姓名的边界,第二列作为标记的文本框,最后我每行都有一个添加按钮)。
谢谢提前。
i have an asp.net web page, in which i am selecting the specific class and division in school. based on these values the gridview will be loaded with the student names(stored in students table in sql server db) in that class. If i want to assign the marks of a test to every student using this gridview all at a time (bulk entries), then how to do it. ( my idea is like, having first column as boundfield for student names, second column as textbox for marks and lastly i have an add button for each row).
Thanks in advance.
推荐答案
是的,你可以做到。
第一列将是BoundField
,另一个将是TemplateField
。
EditItemTemplate
TemplateField
,你将放置你的TextBox
并且在内部> ItemTemplate
一个标签
。
标签
里面ItemTemplate
将显示何时GridView
未处于编辑模式且TextBox
内EditItemTemplate $当$
处于编辑模式时,将显示c $ c>。GridView
你可以轻松地在 Google 中找到示例。
Yes you can do it.
First Column will beBoundField
and other one will be aTemplateField
.
InsideEditItemTemplate
ofTemplateField
, you will place yourTextBox
and insideItemTemplate
oneLabel
.
Label
insideItemTemplate
will show whenGridView
is not in Edit mode andTextBox
insideEditItemTemplate
will show whenGridView
is in Edit mode.
You can easily find examples in Google for that.
这篇关于我可以在gridview的同一行中使用boundfield和textbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!