rockyprince
Programmer
Hi all,
I have a datagrid like this:
----------------------------------------------------
<asp
atagrid id="datagrid" runat="server" width="100%">
<Columns>
<asp:TemplateColumn HeaderText="Date">
<ItemTemplate>
<asp:Label Runat="server" ID="lblDate"><%# DataBinder.Eval(Container.DataItem,"Date","{0
}")%></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp
atagrid>
-------------------------------------------------------
Now, I also have two radio buttons, one to display the "Date" in US format, and the other to change it to UK format.
Is there a way I can change the 'DataBinder.Eval(...' expression in my code behind? to allow me to change the format character '{0
}' to something else.
I have an alternative solution, where I use the following expression instead:
<%#getDate(DataBinder.Eval(Container.DataItem,"date").ToString())%>
...where getDate is a protected function, that formats the date depending on which radio button is checked.
This will work, but I was looking for something more pretty.
Thanks for any help,
Rocky
I have a datagrid like this:
----------------------------------------------------
<asp
<Columns>
<asp:TemplateColumn HeaderText="Date">
<ItemTemplate>
<asp:Label Runat="server" ID="lblDate"><%# DataBinder.Eval(Container.DataItem,"Date","{0
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp
-------------------------------------------------------
Now, I also have two radio buttons, one to display the "Date" in US format, and the other to change it to UK format.
Is there a way I can change the 'DataBinder.Eval(...' expression in my code behind? to allow me to change the format character '{0
I have an alternative solution, where I use the following expression instead:
<%#getDate(DataBinder.Eval(Container.DataItem,"date").ToString())%>
...where getDate is a protected function, that formats the date depending on which radio button is checked.
This will work, but I was looking for something more pretty.
Thanks for any help,
Rocky