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

[Solved] ColumnCreating Problem

1 Answer 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 17 Apr 2009, 06:37 PM
I may have painted myself into a corner, or, being new to Telerik controls, just don't understand what I'm supposed to be doing.

I've inherited from GridBoundColumn to make my own ClientColumn. My ClientColumn class has a DisplayStyle property which determines how data is rendered in the grid. For example, if DisplayStyle is set to 1, then the column will display the ID of the client. If it's set to 2, it will display the name of the client.

I've got two of these columns in my grid, and each sets the DisplayStyle differently.

When the page initially displays, everything looks great. However, when the user pages to the next set of data, the ColumnCreating event fires. I presume that I am supposed to reinstantiate the columns, placing them in e.Column. However, the event doesn't appear to tell me which column I'm supposed to create. It only tells me the type (via the e.ColumnType property). I suppose I could make an assumption that ColumnCreating gets called in the order in which the columns appear, and count calls to ColumnCreating, but that feels extremely kludgey.

Is there a better way to handle this?

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 22 Apr 2009, 10:17 AM
Hello Tom,

Could you post your aspx and code behind since the way you are creating the grid is important to know before a solution to the problem can be indicated. Please, use the Code Block Formatter of the html editor when pasting the code.

Thank you

Looking forward to your feedback.

Best regards,
Tsvetoslav
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.
Tags
Grid
Asked by
Tom
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or