Click here to Skip to main content
15,906,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

C#
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;
Posted
Updated 25-Apr-11 5:04am
v4

1 solution

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


}
 
Share this answer
 
v5
Comments
Tarakeshwar Reddy 25-Apr-11 21:22pm    
Added pre tags.
Cyrus Neah 25-Apr-11 21:25pm    
Thank you Tarakeshwar

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900