I am trying to get the LocationID for the row in the gridview. grdFavoriteMerchant is the gridID. I am new to using开发者_如何学C gridview.
I am using this part of code to get LocationID but it gets MerchantID when row.RowIndex = 0.
int LocationID = Convert.ToInt32(grdFavoriteMerchant.DataKeys[row.RowIndex].Value);
In the aspx, i have DataKeyNames="Merchant_id, zipcode, Location_id"
I am wondering how i can give hardcoded "LocationID" in the above code to get LocationID back.
I hope i am clear :)
Thanks in advance
int LocationID = (int)grdFavoriteMerchant.DataKeys[row.RowIndex][2];
精彩评论