C
Carlos CR
Hello,
I've run into a problem and I'm not sure if this is a limitation of
dotNet or I'm doing something bad,
I've a TemplateColumn in a DataGrid with a LinkButton of which I would
like to dinamically change the Text Field.
The DataGrid definition is like this:
<form runat="server">
<aspataGrid id="ClientsDataGrid" runat="server"
width="100%"
AutoGenerateColumns="false"
[...]
<asp:TemplateColumn
Visible="True">
<HeaderTemplate>
Login
<asp:LinkButton ID="loginASC" CommandName="Sort"
CommandArgument="login ASC" runat="server" Text="<%# upArrow %>" />
<asp:LinkButton id="loginDESC" CommandName="Sort"
CommandArgument="login DESC" runat="server" Text="<%# downArrow %>" />
</HeaderTemplate>
<ItemTemplate>
<a href="edit.aspx?id=<%#DataBinder.Eval(Container.DataItem,
"id_cliente")%>"><%# DataBinder.Eval(Container.DataItem, "login") %></a>
</ItemTemplate>
</asp:TemplateColumn>
The EventHandler for the LinkButton commands looks like this:
void ItemCommand(Object sender, DataGridCommandEventArgs e) {
if(e.CommandName == "Sort") {
SortField = (String) e.CommandArgument;
if(((LinkButton)e.CommandSource).ID.EndsWith("ASC") ) {
Trace.Write("New value=" + upSelArrow );
((LinkButton)e.CommandSource).Text = upSelArrow;
} else {
Trace.Write("New value=" + downSelArrow);
((LinkButton)e.CommandSource).Text = downSelArrow;
}
}
BindGrid();
}
If I turn on tracing I can see the "New value.." message, but the TExt
property doesn't change and it gets the declarative value, instead of the
one given in the method.
What I'm doing wrong?
Thanks in advance for any help..
Carlos CR
I've run into a problem and I'm not sure if this is a limitation of
dotNet or I'm doing something bad,
I've a TemplateColumn in a DataGrid with a LinkButton of which I would
like to dinamically change the Text Field.
The DataGrid definition is like this:
<form runat="server">
<aspataGrid id="ClientsDataGrid" runat="server"
width="100%"
AutoGenerateColumns="false"
[...]
<asp:TemplateColumn
Visible="True">
<HeaderTemplate>
Login
<asp:LinkButton ID="loginASC" CommandName="Sort"
CommandArgument="login ASC" runat="server" Text="<%# upArrow %>" />
<asp:LinkButton id="loginDESC" CommandName="Sort"
CommandArgument="login DESC" runat="server" Text="<%# downArrow %>" />
</HeaderTemplate>
<ItemTemplate>
<a href="edit.aspx?id=<%#DataBinder.Eval(Container.DataItem,
"id_cliente")%>"><%# DataBinder.Eval(Container.DataItem, "login") %></a>
</ItemTemplate>
</asp:TemplateColumn>
The EventHandler for the LinkButton commands looks like this:
void ItemCommand(Object sender, DataGridCommandEventArgs e) {
if(e.CommandName == "Sort") {
SortField = (String) e.CommandArgument;
if(((LinkButton)e.CommandSource).ID.EndsWith("ASC") ) {
Trace.Write("New value=" + upSelArrow );
((LinkButton)e.CommandSource).Text = upSelArrow;
} else {
Trace.Write("New value=" + downSelArrow);
((LinkButton)e.CommandSource).Text = downSelArrow;
}
}
BindGrid();
}
If I turn on tracing I can see the "New value.." message, but the TExt
property doesn't change and it gets the declarative value, instead of the
one given in the method.
What I'm doing wrong?
Thanks in advance for any help..
Carlos CR