Again, that piece of code will and is meant to allow you create a field, say, name; for other fields I guess you're trying to use a sub-query - I'm suggesting you to do it either: 1. at the datasource level OR 2. at the GridView level (event:
RowDataBound)
so, you could create a join and fetch all the data you'd want before you create
any columns or execute a query in the RowDataBound event of the GridView, where you would be able to get all the column values using e.Row.DataItem as has been shown you already.
PeteNet
All-Star
81342 Points
11398 Posts
Re: How do I get the datakey for a DataControlRowType.DataRow when a TemplateField is created in ...
Dec 15, 2010 01:20 AM|LINK
Again, that piece of code will and is meant to allow you create a field, say, name; for other fields I guess you're trying to use a sub-query - I'm suggesting you to do it either: 1. at the datasource level OR 2. at the GridView level (event: RowDataBound)
so, you could create a join and fetch all the data you'd want before you create any columns or execute a query in the RowDataBound event of the GridView, where you would be able to get all the column values using e.Row.DataItem as has been shown you already.
Peter
Evolutionz
Member
261 Points
95 Posts
Re: How do I get the datakey for a DataControlRowType.DataRow when a TemplateField is created in ...
Apr 13, 2012 04:19 PM|LINK
i know i am replying abit late here..i just want to know why this particular code is being used...