在按钮单击期间需要在Gridview中创建一个空行 [英] Need to create an empty row in Gridview during button click

查看:69
本文介绍了在按钮单击期间需要在Gridview中创建一个空行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个带有3个模板字段的Gridview,其中2个是文本框,1个是按钮字段。所以当点击按钮时空行应显示在文本框字段和按钮字段中都没有值。





您能否建议如何实现这...





谢谢和问候,

Mathi

Hi,

I have a Gridview with 3 Template fields in which 2 are text boxes and one will be a button field.So while a button is clicked an empty row should be displayed with no values in both the text box fields and the button field.


Could you please suggest how to achieve this...


Thanks & Regards,
Mathi

推荐答案

检查以下链接:

在C#Asp中将行添加到Gridview中.net [ ^ ]

从ASP.NET GridView动态添加和删除行 [ ^ ]

向ASP.NET GridView添加行? [ ^ ]



所以你基本上将值设置为 String.Empty



祝你好运,

OI
Check the following links:
Adding rows into Gridview in C# Asp.net [^]
Dynamically adding and deleting rows from ASP.NET GridView[^]
Add Row to ASP.NET GridView?[^]

So you basically set the value to String.Empty or "".

Good luck,
OI


DataTable dtMytable = new DataTable();
dtMytable.Columns.Add("Title");
dtMytable.Columns.Add("Description");
dtMytable.Columns.Add("Weightage");
DataRow dr = dtMytable.NewRow();
dtMytable.Rows.Add(dr);

MyGrid.Visible = true;
MyGrid.DataSource = dtMytable;
MyGrid.DataBind();


您好以下代码正常工作





Hi The below code is working


DataTable dtMytable = new DataTable();
dtMytable.Columns.Add("Title");
dtMytable.Columns.Add("Description");
dtMytable.Columns.Add("Weightage");
DataRow dr = dtMytable.NewRow();
dtMytable.Rows.Add(dr);

MyGrid.Visible = true;
MyGrid.DataSource = dtMytable;
MyGrid.DataBind();


这篇关于在按钮单击期间需要在Gridview中创建一个空行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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