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

[Solved] Set SkinID on RadTextBox in GridBoundColumn

2 Answers 176 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gavin
Top achievements
Rank 1
Gavin asked on 22 Apr 2009, 02:50 AM

Hi,

I am trying to set the SkinID of the RadTextBox generated when a GridBoundColumn is in edit mode.

I have tried in the Grids PreRender event but get the error that you can only set a SkinID in the page PreInit event.  However the RadGrid does not exist at this stage.

I there any way to do this without resorting to template columns on everything?

Thanks

Gavin.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Apr 2009, 05:55 AM
Hello Gavin,

The textbox that appears for a bound column when in edit mode is a normal asp:TextBox and not a RadTextBox. However, a suggestionis to set a column editor for the bound column and set the skinid for the editor. You can use a TextBoxColumnEditor  for a GridBoundColumn which has several properties as mentioned in the link below.
GridTextBoxColumnEditor Class Members

Thanks
Princy.
0
Gavin
Top achievements
Rank 1
answered on 24 Apr 2009, 12:08 AM

Hi Princy,

Using a GridTextBoxColumnEditor does not solve the issue as you can not set the SkinID at design time and therefore still run into the same issue.

I have however managed to find a solution to the problem I was having.

The issue was caused by having a master page and the RadGrid control not being available in the PreInit method of pages using a master page.

The fix for this is to add

MasterPage master = this.Master; 

 on the first line of the Page_PreInit method.  This forces the page to load the master page and therefor the controls.  I could then use the following code to set the SkinID.

((GridTextBoxColumnEditor)((GridEditableColumn)(rgAdditionalContact.Columns[1])).CurrentColumnEditor).TextBoxControl.SkinID = "AspWideText"

Cheers

Gavin.

Tags
Grid
Asked by
Gavin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Gavin
Top achievements
Rank 1
Share this question
or