Calling columns by public column name

3 posts, 1 answers
  1. Dominik
    Dominik avatar
    82 posts
    Member since:
    Dec 2012

    Posted 10 Dec 2012 Link to this post

    Hi,

    Creating columns in manual way (using designer) make them only visible in Designer.cs file, because declaration is in InitializeComponent() function.
    How to avoid that, so for example ill able to call cell value like that:
    GridView.Rows[4].Cells[myColumn.name].Value
  2. Answer
    Plamen
    Admin
    Plamen avatar
    132 posts

    Posted 13 Dec 2012 Link to this post

    Hi Dominik,

    Due to certain specifics of the Property Builder architecture, exposing the columns' declarations globally is not a trivial task and it would require major changes in the design-time tool. Therefore, I am not able to preovide any specific time frame in which such a change would be made.

    In this situation, I can only suggest associating the design-time created columns with globally declared variables only once and then use these variables later whenever needed:
    public partial class Form1 : Form
    {
        GridViewTextBoxColumn firstNameCol;
        GridViewTextBoxColumn lastNameCol;
        GridViewTextBoxColumn addressCol;
     
        public Form1()
        {
            InitializeComponent();
     
            firstNameCol = (GridViewTextBoxColumn)this.radGridView1.Columns["column1"];
            lastNameCol = (GridViewTextBoxColumn)this.radGridView1.Columns["column2"];
            addressCol = (GridViewTextBoxColumn)this.radGridView1.Columns["column3"];
        }
    }

    Let me know if you have additional questions or suggestions.

    Regards,
    Plamen
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  3. Dominik
    Dominik avatar
    82 posts
    Member since:
    Dec 2012

    Posted 19 Dec 2012 Link to this post

    Thank you for your reply.

    For now, this is a satisfactory solution.
Back to Top