Hi,

Any of the ASP.NET DataGrid Columns doesn't support DataBinding.

For example I can not use something like this for a BoundColumn to set the
Header Text.

<asp:BoundColumn DataField="Company" HeaderText='<%# DataBinder.Eval
(Container.DataItem,"Adress") %>' ></asp:BoundColumn>

When I try this then I get DataBinding Error.
But this also didn't work:

<asp:BoundColumn DataField="Company" HeaderText='<% GetHeaderText(); %>'
></asp:BoundColumn>

OR

<asp:BoundColumn DataField="Company" HeaderText='<%= GetHeaderText() %>'
></asp:BoundColumn>

Here GetHeaderText() is a public method return some String vale and placed
in the code behind file.
In this case I don't get any error but nothing appear in place of Header
Text, means no Header Text.

Even I get the same case when I don't put semicolon at the end of method
call like this:

<asp:BoundColumn DataField="Company" HeaderText='<% GetHeaderText() %>'
></asp:BoundColumn>

Is there any way I can set the Header Text by getting the value from some
Method call as explained above. I could do it only when I add the columns
to DataGrid in the Code Behind file.

Any pointers ....

Ateek.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to