如何在asp.net中更新行gridview [英] how can update row gridview in asp.net

查看:139
本文介绍了如何在asp.net中更新行gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友.
我有一个问题想在运行时更新gridview数据
我在网格视图中包括了编辑按钮,即使取消按钮也可以正常工作,但是我的更新按钮却无法正常工作,任何人都可以给我c#代码来更新数据. 用于编辑按钮的代码是:gridview1.editindex = e.neweditindex;
gridview1.datasource = getdata();
gridview1.databind();
用于取消按钮:gridview1.editindex = -1;
gridview1.datasource = getdata();
gridview1.databind();
谁能给我更新按钮的代码,以便我的数据在gridview中更新.
谢谢& amp; amp;问候
Deepak

hello friend.
i have one problem i want to update gridview data at run time
i am include edit button in the grid view and its working fine even cancel button is also working fine but my update button is not working any one give me c# code for update the data.
for edit button code is : gridview1.editindex=e.neweditindex;
gridview1.datasource = getdata();
gridview1.databind();
for cancel button : gridview1.editindex = -1;
gridview1.datasource = getdata();
gridview1.databind();
can any one give me code for update button so that my data is update in gridview.
Thanks & Regards
Deepak

推荐答案

感谢朋友我已经解决了这个问题

感谢您的答复
thanks friend i had sort out this problem

thanks for reply


尝试
GridView.UpdateRow 使您能够使用行的字段值更新指定行索引处的记录的方法.

Try
GridView.UpdateRow Method which enable you Updates the record at the specified row index using the field values of the row.
as
void UpdateRowButton_Click(Object sender, EventArgs e)
  {
    // Programmatically update the current record in edit mode.
    CustomersGridView.UpdateRow(CustomersGridView.EditIndex, true);
  }


看看有-MSDN(GridView.UpdateRow方法) [ ^ ]).


Take a look there-MSDN(GridView.UpdateRow Method)[^] for more details.


这篇关于如何在asp.net中更新行gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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