如何在gridview中包含DatePicker TextBox? [英] how to inclued DatePicker TextBox inside gridview ?
问题描述
嗨
我使用过Asp.net GridView,当然我也用自己的绑定了它,我使用以下代码从DB中选择表并将所有数据读入Gridview:
Hi
I have used Asp.net GridView and ofcourse i have bounded it with my own , i have used the following code to select the table from DB and read all data into Gridview:
protected void Button2_Click(object sender, EventArgs e)
{
DataTable dt = DataProvider.ExecuteDataTable("[dbo].[Get_LastInsertedRowHowzeEducation_SP]", CommandType.StoredProcedure);
GridView1.DataSource = dt;
GridView1.DataBind();
}
它的一个列涉及到BirthDate,并且我设计了一个Jquery DatePicker文本框,因此每当我按下 Update 按钮并删除默认的gridview时,我都希望将其包含在Gridview列中作为一个文本框. textbox.so我该怎么做?
-可以回答任何问题-
one of it''s column ralated to BirthDate and i have designed a Jquery DatePicker textbox so i would like to include it inside one of Gridview column as a textbox whenever i press Update button and remove the default gridview textbox.so how can i do that?
--any answer is appreciated--
推荐答案
您需要使用模板字段.TemplateField
对象使您可以指定包含标记和控件的模板,以自定义GridView控件中列的布局和行为.使用ItemTemplate
,可以指定GridView在列中显示数据时要使用的布局.
在这里阅读所有内容:
MSDN:在GridView控件中使用TemplateFields [ MSDN:在GridView Web服务器控件中创建自定义列 [ MSDN:TemplateField.ItemTemplate属性 [ ^ ]
参考:
中的动态模板列ASP.NET 2.0 GridView控件 [
You need to use template fields. ATemplateField
object enables you to specify templates that contain markup and controls to customize the layout and behavior of a column in a GridView control. Using anItemTemplate
, you can specify the layout to be used when the GridView displays data in a column.
Read all about it here:
MSDN: Using TemplateFields in the GridView Control[^]
MSDN: Creating a Custom Column in a GridView Web Server Control[^]
MSDN: TemplateField.ItemTemplate Property[^]
Refer:
Dynamic Template Columns in the ASP.NET 2.0 GridView Control[^]
您好,
如何使用c#.net将datetimepicker添加到gridview单元中?
有人可以帮我吗?
谢谢
问候
拉吉什(Ragesh)
Hello,
How can I add datetimepicker to a gridview cell using c#.net?
Can anybody help me?
Thanks
Regards
Ragesh
这篇关于如何在gridview中包含DatePicker TextBox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!