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

[Solved] Dynamically Skin RadCombobox in Edit Form

1 Answer 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 25 Jan 2010, 05:59 PM

In my app I allow the users to choose a skin and it stores the choice in an application variable.


I am having trouble skinning the control in the edit form.

    Protected Sub rgTimeslips_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles rgTimeslips.ItemCommand  
 
        If (e.CommandName = RadGrid.EditCommandName) Then  
            e.Item.OwnerTableView.EditFormSettings.CaptionFormatString = "Edit Time Slip" 
 
 
            Dim frmitem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)  
            Dim ddlreason As RadComboBox = DirectCast(frmitem.FindControl("ddlReason1"), RadComboBox)  
 
            ddlreason.Skin = Application("TelerikTheme")  
 
        End If  
 
 
    End Sub 

I get an error that says: 
Error Message: Unable to cast object of type 'Telerik.Web.UI.GridDataItem' to type 'Telerik.Web.UI.GridEditFormItem'.


Help please ?


1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 29 Jan 2010, 05:28 AM
Hi David,

You need to move your code to the ItemCreated event and give it a condition of:

if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
}

I hope this helps.

Best regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or