This is a migrated thread and some comments may be shown as answers.

Calling columns by public column name

2 Answers 54 Views
GridView
This is a migrated thread and some comments may be shown as answers.
konrad
Top achievements
Rank 1
konrad asked on 10 Dec 2012, 03:57 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 13 Dec 2012, 03:53 PM
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.
0
konrad
Top achievements
Rank 1
answered on 19 Dec 2012, 08:30 AM
Thank you for your reply.

For now, this is a satisfactory solution.
Tags
GridView
Asked by
konrad
Top achievements
Rank 1
Answers by
Plamen
Telerik team
konrad
Top achievements
Rank 1
Share this question
or