gridview objectDataSet BusinessLayer

R

Richard Roche

My business object populates the gridview, but i'm having difficulty
programatically drilling in and changing the headertext at runtime (I need to
change the language of the column heading based on the client). In the
gridview object the column collection is empty, count = 0. Why? Do i need
to drill into the control object? What is the best approach?

Any help appreciated.
 
M

Manish Bafna

Hi,
you can write a code behind function of the page:
<Columns>
<asp:BoundField HeaderText="<%# GetHeaderText() %>"
DataField="ProductName" SortExpression="ProductName">
</asp:BoundField>
</Columns>

and in the code behind file of your page define a custom function
GetHeaderText() where you define the logic for displaying/manipulating the
header text:

public string GetHeaderText()
{
return "Header Text";
}
 
M

Manish Bafna

Hi,
please ignore my previous post.It should be like below:
you can write a code behind function of the page:
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:Label ID="Label1" runat="server" Text="<%# GetHeaderText()
%>"</asp:Label>
</HeaderTemplate>
</asp:TemplateField>
</Columns>
and in the code behind file of your page define a custom function
GetHeaderText() where you define the logic for displaying/manipulating the
header text:

public string GetHeaderText()
{
return "Header Text";
}
for more details refer
link:http://www.eggheadcafe.com/community/aspnet/2/10020486/change-the-header-text-in.aspx
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.
 
R

Richard Roche

Thanks for the reply. Is there no way to iterate thru the collection? This
was available with the datagrid in framework 1.1. There are nearly 50
columns and it would be very easy to write a procedure to change the header
in logic.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top