I have rad grid in user control and I want to edit in the grid on row double click .My problem is that when I write the javascript code in user control is not working and gives error "RowDblClick not undefine" when I write the code in the aspx page "parent window" javascript is calling but grid not found is shown in that page.I donot know what is the problem can any one help me.I want to write this javascript code in user control not in the parent window beacuse I want resuable user control not like that half portion of code in user control and half portion in aspx page.
<script type="text/javascript"> function RowDblClick(sender, eventArgs) { debugger //sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical()); editedRow = eventArgs.get_itemIndexHierarchical(); $find("<%= grdEvaluation.MasterTableView.ClientID %>").editItem(editedRow); } </script>
<telerik:RadGrid ID="grdEvaluation" runat="server" AllowSorting="True" Skin="Outlook" Width="100%" AutoGenerateColumns="false"> <MasterTableView Width="100%" EditMode="EditForms" DataKeyNames="QuestNo" Dir="<%$ Resources:Common,DIR %>"> <GroupByExpressions> <telerik:GridGroupByExpression> <SelectFields> <telerik:GridGroupByField FieldName="EvalGroupName" HeaderText="Group Name"></telerik:GridGroupByField> </SelectFields> <GroupByFields> <telerik:GridGroupByField FieldName="EvalGroupName" SortOrder="Ascending"></telerik:GridGroupByField> </GroupByFields> </telerik:GridGroupByExpression> </GroupByExpressions> <Columns> <telerik:GridTemplateColumn HeaderText="Question"> <ItemTemplate> <asp:Label ID="lblQuestion" runat="server"></asp:Label> <asp:Label ID="lblQuestionTypeID" runat="server" Visible="false"></asp:Label> </ItemTemplate> <ItemStyle Width="40%" /> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="QuestionType"> <ItemTemplate> <asp:Label ID="lblQuestionType" runat="server"></asp:Label> </ItemTemplate> <ItemStyle Width="10%" /> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Answer"> <ItemTemplate> <asp:Label ID="lblAnswer" runat="server"></asp:Label> <asp:HiddenField ID="hfAnswer" runat="server" /> </ItemTemplate> <ItemStyle Width="50%" /> </telerik:GridTemplateColumn> </Columns> <EditFormSettings EditFormType="Template"> <EditColumn UniqueName="EditCommandColumn1"> </EditColumn> <FormTemplate> <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0"> <tr> <td style="width: 5%"> <asp:Label ID="Label2" runat="server" Text="Question :"></asp:Label> </td> <td style="width: 95%"> <asp:Label ID="lblQuestions" runat="server" Text='<%# Bind("QuestionName") %>'></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="Label3" runat="server" Text="Answer :"></asp:Label> </td> <td> <asp:TextBox ID="txtAnswer" TextMode="MultiLine" Height="50px" Width="900px" runat="server" Visible="false" Text='<%# Bind("Answer") %>'></asp:TextBox> <asp:DropDownList ID="ddlAnswer" runat="server" Visible="false"> </asp:DropDownList> </td> </tr> </table> <table style="width: 20%;"> <tr> <td align="center" colspan="2"> <asp:Button ID="Button1" Text="Update" runat="server" CommandName="Update" CausesValidation="false"> </asp:Button> <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"> </asp:Button> </td> </tr> </table> </FormTemplate> <%--<PopUpSettings Modal="True"></PopUpSettings>--%> </EditFormSettings> </MasterTableView> <ClientSettings EnablePostBackOnRowClick="false"> <ClientEvents OnRowDblClick="RowDblClick" /> </ClientSettings> </telerik:RadGrid>