开发者

GridView DataKeys Always returns Integer value

I have an ASP.NET GridView with DataKeyNames="EmployeeNumber" where EmployeeNumber is the primary key in the Employees table and a foreign key in many other tables.

EmployeeNumber is a varchar field where employee numbers can start with a leading significant 0. In other words, Employee Number 247 != EmployeeNumber 0247. (Ask HR about that one, no it cannot be changed.)

This is causing an issue with my gridview. When I access开发者_如何学JAVA the DataKeys collection it always returns an integer value which returns the wrong employee number.

Is there a way I can get the GridView.DataKeys[0] to return a string instead of an integer. It seems that it is a collection of type object which would lead me to believe that their is a way.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜