开发者

Gridview Datakeys problem

开发者 https://www.devze.com 2023-03-17 19:34 出处:网络
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 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];
0

精彩评论

暂无评论...
验证码 换一张
取 消