RadGridView column header text

7 posts, 0 answers
  1. Stefano Zambonin
    Stefano Zambonin avatar
    11 posts
    Member since:
    Jul 2009

    Posted 06 Aug 2009 Link to this post

    After populating RadGridView with AutoGenerateColumns = true i try to change the column header text:

    RGVBBoxRecords.Columns[idx].HeaderText = headerstr[idx];
    or
    RGVBBoxRecords.Columns[idx].Header = headerstr[idx];

    but nothing changes.

    How to do it?

     

  2. Allan
    Allan avatar
    8 posts
    Member since:
    Jan 2008

    Posted 06 Aug 2009 Link to this post

    I have the same problem using Radcontrols for WPF v. 2009.2.701.35.

    My code uses a dictionary as resource and dynamicresource to bind to it.

                <Controls:RadGridView.Columns>
                    <Controls:GridViewDataColumn HeaderText="{DynamicResource WindowMain_RadGridViewCustomers_CompanyName}" UniqueName="CompanyName" />
                </Controls:RadGridView.Columns>

    Any solutions to this problem or do i need to reinstall the previous version where the problem doesn't exist?




  3. UI for WPF is Visual Studio 2017 Ready
  4. Missing user
    Missing user avatar

    Posted 06 Aug 2009 Link to this post

    Hello,

    @ Allan:
    With our Q2 2009 we introduced new column property Header (of type object)  similar to MS DataGrid and now HeaderText is obsoleted.

    @Stefano Zambonin:
    You may try to subscribe to the DataLoaded event of the RadGridView and  perform updates to the desired column header like this:

    void gridview_DataLoaded(object sender, EventArgs e)
            {
                this.RadGridView1.Columns[0].Header = "Test1";
            }

    Hope this helps.

    Best wishes,

    Anastasia
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Stefano Zambonin
    Stefano Zambonin avatar
    11 posts
    Member since:
    Jul 2009

    Posted 06 Aug 2009 Link to this post

    Exactly what i'm doing:

     

    void RGVBBoxRecords_DataLoaded(object sender, EventArgs e)

     

    {

     

      for (int idx = 0; idx < RGVBBoxRecords.Columns.Count; ++idx)

     

      {

     

        if (idx < headerstr.Count)

     

        {

        RGVBBoxRecords.Columns[idx].Header = headerstr[idx];

        }

      }

    .......

    and in fact watching with debugger i can see that the Header field is setup properly but nothing happens really: on the screen there are the old strings.
  6. Allan
    Allan avatar
    8 posts
    Member since:
    Jan 2008

    Posted 06 Aug 2009 Link to this post

    That did the trick... :) That should teach me a lesson, but I can't seem to remember what? :p Could it be something with changes since last version?

    Thanks alot for the quick response...

  7. Missing user
    Missing user avatar

    Posted 06 Aug 2009 Link to this post

    Hi Stefano Zambonin,


    Unfortunatelly I couldn't reporoduce the described problem with our official 2009Q2 binaries. Can you please tell us which version of our controls are you using?

    However a possible workaround is to subscribe to the AutoGeneratingColumn event:

     void RGVBBoxRecords_AutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e)  
            {  
                  e.Column.Header = headerstr[counter];  
                  counter++;  
            } 

    Please find attached a simple application.

    Greetings,

    Anastasia
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. Stefano Zambonin
    Stefano Zambonin avatar
    11 posts
    Member since:
    Jul 2009

    Posted 06 Aug 2009 Link to this post

    Ok, this way works but if possible i would prefer to use the other way (cleaner code).

    I'm using 1 july Q9 2009 version.

     

    Stefano Zambonin

    Risorse Informatiche srl

Back to Top
UI for WPF is Visual Studio 2017 Ready