when to dynamically change datagrid column headers

Discussion in 'ASP .Net' started by gh0st54, Jan 30, 2005.

  1. gh0st54

    gh0st54 Guest

    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


    }
    gh0st54, Jan 30, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gh0st54
    Replies:
    2
    Views:
    5,458
    Eliyahu Goldin
    Jan 31, 2005
  2. =?Utf-8?B?Sm9obiBXYWxrZXI=?=

    Freezing Datagrid Column Headers

    =?Utf-8?B?Sm9obiBXYWxrZXI=?=, Jan 18, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    2,947
    =?Utf-8?B?Sm9obiBXYWxrZXI=?=
    Jan 18, 2006
  3. Krishna
    Replies:
    0
    Views:
    511
    Krishna
    Jul 13, 2006
  4. James
    Replies:
    0
    Views:
    493
    James
    Sep 21, 2006
  5. Nathan Baulch
    Replies:
    1
    Views:
    127
    Nathan Baulch
    Sep 19, 2003
Loading...

Share This Page