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

[Solved] Combobox template in a RadGrid Edit Form Template

2 Answers 226 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 08 Dec 2009, 08:08 PM
Im trying to use the comboxbox from this demo (just the first one) whithin a radgrid edit form template like this demo.  This is all wrapped up in an RadAjaxPanel and the grid is set to the following.
<telerik:RadGrid ID="RadGrid1" runat="server"  
            AllowPaging="True" AllowSorting="True" GridLines="None"  
            ShowGroupPanel="True" Width="795px" Style="margin-left:15px;" 
        DataSourceID="XmlDataSource2" AutoGenerateDeleteColumn="True" ShowStatusBar="true" 
            AutoGenerateEditColumn="True" > 
 
                <MasterTableView autogeneratecolumns="False" EditMode="PopUp" CommandItemDisplay="Top"  
                datasourceid="XmlDataSource2"
 
                <EditFormSettings EditFormType="Template" InsertCaption="New Journal Entry" PopUpSettings-Modal="true"


However, the javascript from the first demo in Default.cs.aspx, specifically the following, throws the following error.  Since the javascript has no clue how to find the id of something that is yet to exist what do you recommend that I do here?  The dropdown code worked just fine until I put it in the editform template.  ;-)
var combo = $find("<%= RadComboBox1.ClientID %>"); 



Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 21: Line 22:             function onCheckBoxClick(chk) {Line 23:                 var combo = $find("<%= RadComboBox1.ClientID %>");

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Dec 2009, 07:09 AM
Hello Marc,

You can check out the following code library submision which explains on how to access the controls in a template in the grid. You can use the same logic for accessing controls in the EditFormTemplate.
Accessing server controls in a grid template on the client

Hope this helps..
Princy.
0
Marc
Top achievements
Rank 1
answered on 09 Dec 2009, 07:01 PM
I think your link was broken.  I found it here though.  Thanks for the help. However, while that is a clever approach (the push js method) and works, I think I would rather get my user control approach working instead as there is less code to maintain by going that route.
Tags
Grid
Asked by
Marc
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Marc
Top achievements
Rank 1
Share this question
or