在ASP.NET中的更新命令GridView中获取GridRow的NewValues [英] Get NewValues of GridRow in Update Command GridView in ASP.NET
本文介绍了在ASP.NET中的更新命令GridView中获取GridRow的NewValues的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在ASP.NET中的更新命令GridView中获取GridRow的NewValue?
我在Quick-watch中找到了它,但是在代码设计Visual Studio中不起作用.
How i can Get NewValues of GridRow in Update Command GridView in ASP.NET?
i found it in Quick-watch ,But it does not work in code Design Visual Studio.
string k = ((System.Collections.DictionaryEntry)((new System.Collections.ArrayList.ArrayListDebugView(((new System.Collections.Specialized.OrderedDictionary.OrderedDictionaryKeyValueCollection)((e.NewValues as System.Collections.Specialized.OrderedDictionary).Values))._objects)).Items[1])).Value;
推荐答案
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
// This is where you access the edited values
int anumber = Convert.ToInt16(GridView1.Rows[e.RowIndex].Cells[0].Text); // this is some number for example
string a_text = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text; //a_text
string another_text = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text; //another_text
//manipulate or validate these values like===> if(anumber < 0){anumber = 0;}
// call your update method here
// yourupdatefunction(a_number,a_text,another_text);
GridView1.EditIndex = -1;
BindGridView(); // reflect changes made
}
这篇关于在ASP.NET中的更新命令GridView中获取GridRow的NewValues的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文