asp:ButtonColumn Text
-
I hope somebody can help me with this. I have got this DataGrid, with a buttoncolumn, and my problem is that depending on the language the user has chosen, it should show one text, or another. The language is saved on Session=("language"), it can be "EN" English, or "ES" Spanish. So, how could I write this column? I tried this:
<asp:ButtonColumn Text="<% if Session("language") = "ES" then Response.Write ("Editar") else ("Edit") end if %>" CommandName="Select">
I get an error.
Error 1 The literal content ('<asp:ButtonColumn Text="') is not allowed in 'System.Web.UI.WebControls.DataGridColumnCollection'.
(The error message is translated to English, it is not probably the real text)
-
I hope somebody can help me with this. I have got this DataGrid, with a buttoncolumn, and my problem is that depending on the language the user has chosen, it should show one text, or another. The language is saved on Session=("language"), it can be "EN" English, or "ES" Spanish. So, how could I write this column? I tried this:
<asp:ButtonColumn Text="<% if Session("language") = "ES" then Response.Write ("Editar") else ("Edit") end if %>" CommandName="Select">
I get an error.
Error 1 The literal content ('<asp:ButtonColumn Text="') is not allowed in 'System.Web.UI.WebControls.DataGridColumnCollection'.
(The error message is translated to English, it is not probably the real text)
Hi, you can you use the DataBound event of the grid to set the text of the button, but the best practice is to set the UI culture by overriding the following event in your page:
protected override void InitializeCulture()
{
System.Threading.Thread.CurrentThread.CurrentUICulture = "the culture";
System.Threading.Thread.CurrentThread.CurrentCulture = "the culture";
}Regards, Jamil
-
Hi, you can you use the DataBound event of the grid to set the text of the button, but the best practice is to set the UI culture by overriding the following event in your page:
protected override void InitializeCulture()
{
System.Threading.Thread.CurrentThread.CurrentUICulture = "the culture";
System.Threading.Thread.CurrentThread.CurrentCulture = "the culture";
}Regards, Jamil
Thanks for answering Jamil. I'm sorry, I don't know anything about what you say, that UI Culture thing... And when you say Databound, doy you mean databinding? I don't see any databound event on the grid, just data binding. I'm using VS2005, by the way. Thanks in advance. PS: How could I complete the code?
datagrid.columns(i).text = "ES"
There is no text property on columns collection.