I'm looking for an easy way to loop thru and address all texts in a grid to create multiple language support by fetching texts in users language from DB:
- AddNewRecordText in CommandItemSettings
- CancelText, UpdateText and InsertText in EditColumn
- EditText in GridEditCommandColumn
and HeaderText in all columns.
For all other controls on the page, I loop thru the controls like this:
protected void Page_PreRender(object sender, EventArgs e)
{
foreach (Control ctrl in Page.Controls)
{
findCtrl(ctrl);
}
}
protected void FormView_DataBound(object sender, EventArgs e)
{
foreach (Control ctrl in FormView.Controls)
{
findCtrl(ctrl);
}
}
public void findCtrl(Control ctrlTry)
{
if (ctrlTry.HasControls()) // if the control contrains other controls
{
if (ctrlTry.ID != null && ctrlTry.ID != "") // control has a ID-name
{
Response.Write(ctrlTry.ID + "<BR>");
}
- AddNewRecordText in CommandItemSettings
- CancelText, UpdateText and InsertText in EditColumn
- EditText in GridEditCommandColumn
and HeaderText in all columns.
For all other controls on the page, I loop thru the controls like this:
protected void Page_PreRender(object sender, EventArgs e)
{
foreach (Control ctrl in Page.Controls)
{
findCtrl(ctrl);
}
}
protected void FormView_DataBound(object sender, EventArgs e)
{
foreach (Control ctrl in FormView.Controls)
{
findCtrl(ctrl);
}
}
public void findCtrl(Control ctrlTry)
{
if (ctrlTry.HasControls()) // if the control contrains other controls
{
if (ctrlTry.ID != null && ctrlTry.ID != "") // control has a ID-name
{
Response.Write(ctrlTry.ID + "<BR>");
}
foreach (Control lastCtrl in ctrlTry.Controls)
{
findCtrl(lastCtrl);
}
}
else
{
if (ctrlTry.ID != null && ctrlTry.ID != "")
{
Response.Write(ctrlTry.ID + "<BR>");
}
}
}
and use the controls ID to fetch the text from the DB.
But this approach doesn't work on texts in a grid.
Any ideas for multiple language support in grids using lookup i DB?