如何从gridview页脚动态添加行 [英] How to add rows dynamically from gridview footer

查看:94
本文介绍了如何从gridview页脚动态添加行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



我想在文本框中添加gridview中的值temprory。我参考了这个网站:



http://www.c-sharpcorner.com/uploadfile/8c19e8/dynamically-adding-and-deleting-rows-in-gridview - 并且保存/



当没有数据绑定它执行的罚款时它被执行..但是我需要,在将值绑定到gridview之后然后我添加额外的行..



绑定值后我的概率是什么,我点击添加按钮绑定的值被清除然后新添加行。





请帮帮我...





谢谢和问候,

Vivek .R

解决方案

在提到的项目中,用户调用方法 SetInitialRow 进行数据绑定。



上述项目是对的。但是您只需要使用 Eval Bind 进程将数据与gridview绑定在 Page_Load



只需按照Databind的流程

 <   asp:TemplateField     HeaderText   =  FirstName   >  
< ItemTemplate >
< asp:标签 ID = Label1 runat = server

文本 =' <% #Bind( FirstName)%>' > < / asp:Label >
< / ItemTemplate >
< / asp:TemplateField >





之后只是将数据从数据库中获取到 DataSet DataTable 并使用 Gridview


Dear Frds,

I want to add values temprory in gridview from text box. I reffered this website:

http://www.c-sharpcorner.com/uploadfile/8c19e8/dynamically-adding-and-deleting-rows-in-gridview-and-saving/

Its executed when without databind its executed fine.. but i need, after bind values to gridview then i add extra rows..

what is my prob after bind the values, i click add button binded values are cleared then newly add row.


please help me...


Thanks & Regards,
Vivek .R

解决方案

In the Mentioned project, user call the method SetInitialRow for databinding.

The mentioned project is right. But you just need to use Eval Or Bind process for binding your data with gridview at Page_Load

Just follow the process for Databind

<asp:TemplateField HeaderText="FirstName" >
    <ItemTemplate>
        <asp:Label ID="Label1" runat="server"

            Text='<%# Bind("FirstName") %>'></asp:Label>
    </ItemTemplate>
</asp:TemplateField>



After that just get your data from database into DataSet or DataTable and Bind the Data with Gridview


这篇关于如何从gridview页脚动态添加行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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