GridViewUpdateEventArgs.Keys miss after sort

A

ad

I have set "Years,GradeID" as DataKeyNames of a GridView.I use the codes
below to get the Keys value of a GridView, it is ok.

But if I sort this GridView on Pageload like:

gv.Sort("Years", SortDirection.Descending);

The e.e.Keys["Years"] is not define in the RowUpdating event.

What's problem? How can I get the Keys value after sort?



protected void gvCheckSem_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
int iYears = int.Parse(e.Keys["Years"].ToString());
int iGrade = int.Parse(e.Keys["GradeID"].ToString());
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top