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

Double click in rad grid is not working

8 Answers 219 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Farrukh
Top achievements
Rank 1
Farrukh asked on 20 Jan 2011, 07:47 AM
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>


8 Answers, 1 is accepted

Sort by
0
Elliott
Top achievements
Rank 2
answered on 20 Jan 2011, 05:50 PM
not sure what you are doing with parent window but...
did you try putting your script in a RADCodeBlock control?
0
Vasil
Telerik team
answered on 21 Jan 2011, 03:29 PM
Hello Farrukh,

Can you specify if the user control is loaded dynamically?
If so, try wrapping the script in RadScriptBlock.

Kind regards,
Vasil
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Farrukh
Top achievements
Rank 1
answered on 23 Jan 2011, 06:08 AM
No I am not adding control dynamically and also my code in radcodeblock
0
Farrukh
Top achievements
Rank 1
answered on 23 Jan 2011, 06:13 AM

This is my parent window control I have two user control Control A and Control B and One parent window.In control B I have radgrid and Control B is calling from control A and Control A is in Parent window. 


<%@ Page Language="C#" MasterPageFile="~/App.master" AutoEventWireup="true" CodeBehind="CourseEvaluation.aspx.cs"
    Inherits="TRNWeb.Pages.CourseEvaluation" %>
  
<%@ Register Src="~/CommonObjects/CRUDControls.ascx" TagName="CRUDControls" TagPrefix="ButtonControls" %>
<%@ Register Src="~/CommonObjects/FrameTop.ascx" TagName="FrameTop" TagPrefix="FrameTopObject" %>
<%@ Register Src="~/CommonObjects/FrameBot.ascx" TagName="FrameBot" TagPrefix="FrameBotObject" %>
  
<%@ Register Src="../../UserControls/TrainingCourses/ucRecordEvaluation.ascx" TagName="ucRecordEvaluation"
    TagPrefix="uc2" %>
<asp:Content ID="Content2" ContentPlaceHolderID="WorkSpace" runat="Server">
    <table border="0" cellpadding="0" cellspacing="0" class="TransparentTable">
        <tr>
            <td style="width: 1%; vertical-align: top">
                <ButtonControls:CRUDControls ID="CRUDControls1" runat="server" OnButtonClicked="ButtonClicked" />
                <table border="0" cellpadding="0" cellspacing="0" class="TransparentTable">
                    <tr>
                        <td colspan="3">
                            <asp:ValidationSummary ID="ValidationSummary" runat="server" CssClass="Error" Font-Names="Tahoma"
                                Font-Size="Medium" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <asp:Label CssClass="MessageService" ID="Lbl_Message" runat="server" Text="" meta:resourcekey="Lbl_Message"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 1%" style="vertical-align: top">
                        </td>
                        <td style="width: 98%" style="vertical-align: top">
                            <FrameTopObject:FrameTop ID="FrameTop1" runat="server" />
                            <uc2:ucRecordEvaluation ID="uc_Objects" runat="server" OnRaiseError="RaiseError"
                                OnClearError="ClearError" OnMessageService="MessageService" OnButtonClicked="ButtonClicked" />
                            <FrameBotObject:FrameBot ID="FrameBot1" runat="server" />
                        </td>
                        <td style="width: 1%" style="vertical-align: top">
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
0
Vasil
Telerik team
answered on 26 Jan 2011, 04:25 PM
Hi Farrukh,

I created a project using the description in your last post. Javascript code is in the user controlB and it works fine here. RowDblClick function is executed on OnRowDblClick event. Please see the attached web site and tell us what are the differences in your site.

Best wishes,
Vasil
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Farrukh
Top achievements
Rank 1
answered on 27 Jan 2011, 08:56 AM
Yes I found the problem after posting your code .I am using given below code in master page.
<asp:ScriptManager ID="ScriptManager1" runat="server">
  </asp:ScriptManager>
      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
          <ContentTemplate>
              <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
              </asp:ContentPlaceHolder>
          </ContentTemplate>
      </asp:UpdatePanel>

When I remove update panel from master page its working fine but when I implement this update panel same problem coming again .So there is any solution to do this in current coding style.
0
Accepted
Vasil
Telerik team
answered on 27 Jan 2011, 09:50 AM
Hi Farrukh,

I placed the ContentPlaceHolder1 into an UpdatePanel. And the code is still working fine. The difference here is that I defined the RadScriptManager outside the UpdatePanel.  Please see the attachment.

Best wishes,
Vasil
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Farrukh
Top achievements
Rank 1
answered on 27 Jan 2011, 11:22 AM
I dont know why is not working in my senerio I remove update panel its working with update panel its not working .
Tags
Grid
Asked by
Farrukh
Top achievements
Rank 1
Answers by
Elliott
Top achievements
Rank 2
Vasil
Telerik team
Farrukh
Top achievements
Rank 1
Share this question
or