G
gh0st54
hi
still working on changing my data grid headers using resource files
the thing is i always gat a count of 0 for my datagrid columns count, when
will i get the columns count and when should i change the headers ??
thanks
private void Page_Load(object sender, System.EventArgs e)
{
this.sqlDataAdapter1.Fill(this.emp1,"Employees");
this.DataGrid1.DataBind();
Response.Write("columns :" + this.DataGrid1.Columns.Count);
// Put user code to initialize the page here
SetUI();
if(!Page.IsPostBack)
{
this.txtCulture.Text = Thread.CurrentThread.CurrentCulture.Name;
}
private void SetUI()
{
double d = 10.25;
Thread.CurrentThread.CurrentCulture = new
CultureInfo(this.txtCulture.Text);
Thread.CurrentThread.CurrentUICulture =
Thread.CurrentThread.CurrentCulture;
ResourceManager rm = new
ResourceManager("Demo.Strings",System.Reflection.Assembly.GetExecutingAssemb
ly());
if(Page.Controls.Count>1){
foreach( System.Web.UI.Control ctrl in
Page.FindControl("Form1").Controls) {
this.lblIds.Text += "<br/>Control : " + ctrl.ClientID.ToString()
+ " Control type" + ctrl.GetType().ToString();
//Response.Write();
if (ctrl.GetType().ToString() ==
"System.Web.UI.WebControls.DataGrid"){
DataGrid dg = (System.Web.UI.WebControls.DataGrid )ctrl;
foreach (DataGridColumn col in dg.Columns){
this.lblIds.Text += " <br/> Column header text :" +
col.HeaderText ;
}
}
}
}
// then use rm to set text
}
still working on changing my data grid headers using resource files
the thing is i always gat a count of 0 for my datagrid columns count, when
will i get the columns count and when should i change the headers ??
thanks
private void Page_Load(object sender, System.EventArgs e)
{
this.sqlDataAdapter1.Fill(this.emp1,"Employees");
this.DataGrid1.DataBind();
Response.Write("columns :" + this.DataGrid1.Columns.Count);
// Put user code to initialize the page here
SetUI();
if(!Page.IsPostBack)
{
this.txtCulture.Text = Thread.CurrentThread.CurrentCulture.Name;
}
private void SetUI()
{
double d = 10.25;
Thread.CurrentThread.CurrentCulture = new
CultureInfo(this.txtCulture.Text);
Thread.CurrentThread.CurrentUICulture =
Thread.CurrentThread.CurrentCulture;
ResourceManager rm = new
ResourceManager("Demo.Strings",System.Reflection.Assembly.GetExecutingAssemb
ly());
if(Page.Controls.Count>1){
foreach( System.Web.UI.Control ctrl in
Page.FindControl("Form1").Controls) {
this.lblIds.Text += "<br/>Control : " + ctrl.ClientID.ToString()
+ " Control type" + ctrl.GetType().ToString();
//Response.Write();
if (ctrl.GetType().ToString() ==
"System.Web.UI.WebControls.DataGrid"){
DataGrid dg = (System.Web.UI.WebControls.DataGrid )ctrl;
foreach (DataGridColumn col in dg.Columns){
this.lblIds.Text += " <br/> Column header text :" +
col.HeaderText ;
}
}
}
}
// then use rm to set text
}