如何在一次单击中编辑整个gridview数据 [英] how to Edit Whole gridview data ina single click
本文介绍了如何在一次单击中编辑整个gridview数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我想通过单击一个按钮来更新整个网格数据,同时这样做,即使我已将网格绑定代码放在side(!ispostback)中,我也只是失去了新输入的数据.
我怎么可能呢?
提前thnx
hello,
i want to update whole grid data in a single button click, while doing so,i m just loosing the newly entered data, even though i had put the grid binding code in side(!ispostback).
how can i do it possible ??
thnx in advance
推荐答案
为此,您可以在GridView的每个单元格中使用文本框和标签,请在ItemTemplate中进行操作. 当您要编辑GridView时,在文本框中显示单元格数据,对其进行编辑并保留一个用于更新的按钮.
单击按钮后,更新网格视图并隐藏所有文本框,并在标签中显示单元格数据.
希望这会帮助你. :)
For this you can use TextBoxes & Labels in every cell of GridView, do it in ItemTemplate.
When you want to edit GridView, display cell data in textboxes, edit it and keep a button for update.
After clicking button, update your gridview and hide all textboxes and display cell data in labels.
Hope this will help you. :)
您可以使用Edit, Update, Cancel CommandField
.
阅读 MSDN [
You can useEdit, Update, Cancel CommandField
.
Read MSDN[^] article for details on how to use it.
dineshmehra1写道:
dineshmehra1 wrote:
我只是丢失了新输入的数据,即使我将网格绑定代码放在了side(!ispostback)
i m just loosing the newly entered data, even though i had put the grid binding code in side(!ispostback)
编辑行后,需要重新绑定GridView.因此,请调用再次从数据库获取数据的函数.
希望对您有所帮助!
After you edit a row, you need to rebind the GridView. So call the function which gets data from the database again.
Hope this helps!
请参阅下面的链接
链接:)
See link below
Link :)
这篇关于如何在一次单击中编辑整个gridview数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文