My resultset comes from a dynamic query, so that the column names are not known in advance.
GridView could automatically generate columns if AutoGenerateColumns property is set to true. You could try to let your GridView automatically generate columns, this sample is for your reference.
Member
29 Points
168 Posts
How to call Eval by column index?
Apr 22, 2015 06:07 AM|lucky7456969|LINK
Hello,
My resultset comes from a dynamic query, so that the column names are not known in advance.
When binding those up with the GridView, I can't call Eval by name, how do I call them by column index?
Thanks
Jack
Star
13650 Points
5476 Posts
Re: How to call Eval by column index?
Apr 22, 2015 08:04 AM|Ashim Chatterjee|LINK
You can't.You can use DataItem here for explicit casting see https://support2.microsoft.com/default.aspx?scid=kb;en-us;307860.
All-Star
39156 Points
5688 Posts
Microsoft
Re: How to call Eval by column index?
Apr 23, 2015 01:09 AM|Fei Han - MSFT|LINK
Hi Jack,
Thanks for your post.
GridView could automatically generate columns if AutoGenerateColumns property is set to true. You could try to let your GridView automatically generate columns, this sample is for your reference.
Best Regards,
Fei Han
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue.