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

Javascript error when using updatepanel

3 Answers 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Babu Puchakayala
Top achievements
Rank 1
Babu Puchakayala asked on 09 Jul 2010, 01:35 AM
Hi,

I am new to telerik control. I am upgrading gridview to radgrid.

 I am getting error (see image 1.JPG) when i am using radgrid in asp:updatepanel control. am getting this error foreveryaction(like sorting, filtering, editing, row selecting, scrolling). Can anyone help me how to sove this.

I have a linkbutton column in radgrid. when i click the button i am getting error( see image 2.JPG). How to do it in radgrid. I just want to pull sId, orderId, and taskstatus when i clicked on a linkbutton. when i am trying to do this i am getting that error. Please help to solve this.

here is my code

<asp:UpdatePanel ID="rg200UpdatePanel" runat="server">
                        <ContentTemplate>
                            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                            </telerik:RadScriptManager>
                            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                                <ClientEvents OnRequestStart="onRequestStart" />
                                <AjaxSettings>
                                    <telerik:AjaxSetting AjaxControlID="rg200">
                                        <UpdatedControls>
                                            <telerik:AjaxUpdatedControl ControlID="rg200" LoadingPanelID="RadAjaxLoadingPanel1" />
                                            <telerik:AjaxUpdatedControl ControlID="RadMenu1" />
                                        </UpdatedControls>
                                    </telerik:AjaxSetting>
                                    <telerik:AjaxSetting AjaxControlID="RadMenu1">
                                        <UpdatedControls>
                                            <telerik:AjaxUpdatedControl ControlID="rg200" LoadingPanelID="RadAjaxLoadingPanel1" />
                                            <telerik:AjaxUpdatedControl ControlID="RadMenu1" />
                                        </UpdatedControls>
                                    </telerik:AjaxSetting>
                                </AjaxSettings>
                            </telerik:RadAjaxManager>
                            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
                            </telerik:RadAjaxLoadingPanel>
                            <input type="hidden" id="radGridClickedRowIndex" name="radGridClickedRowIndex" />
                            <telerik:RadGrid ID="rg200" runat="server" AutoGenerateColumns="False" PageSize="30"
                                Height="550px" Width="100%" AllowPaging="True" AllowSorting="True" AllowMultiRowSelection="True"
                                EnableHeaderContextMenu="True" GridLines="None" EnableHeaderContextFilterMenu="True"
                                AllowMultiRowEdit="true" AllowFilteringByColumn="True" OnPreRender="rg200_PreRender"
                                OnItemCreated="rg200_ItemCreated" EnableViewState="true" OnUpdateCommand="rg200_UpdateCommand"
                                AllowAutomaticDeletes="false" AllowAutomaticInserts="false" AllowAutomaticUpdates="false"
                                OnPageIndexChanged="rg200_PageIndexChanged" OnItemCommand="rg216_ItemCommand">
                                <HeaderStyle Height="20px" BackColor="#004000" Font-Size="8pt" Font-Bold="True" ForeColor="White"
                                    HorizontalAlign="Center" BorderColor="White" BorderWidth="1px" />
                                <ExportSettings IgnorePaging="true" ExportOnlyData="true">
                                    <Pdf AllowModify="false" AllowPrinting="true" PageBottomMargin="" PageFooterMargin=""
                                        PageHeaderMargin="" PageHeight="11in" PageLeftMargin="" PageRightMargin="" PageTopMargin=""
                                        PageWidth="14in" />
                                </ExportSettings>
                                <MasterTableView GridLines="None" DataKeyNames="orderId" CommandItemDisplay="Top"
                                    EditMode="EditForms">
                                    <CommandItemTemplate>
                                        <div style="padding: 5px 5px;">
                                            <table>
                                                <tr class="customFont">
                                                    <td align="left">
                                                        <b>Bulk Actions</b>    
                                                    </td>
                                                    <td align="left">
                                                        <asp:LinkButton ID="btnEditSelected" runat="server" OnClick="btnEditSelected_click"
                                                            Visible='<%# rg200.EditIndexes.Count == 0 %>'>Edit Selected</asp:LinkButton>
                                                            
                                                    </td>
                                                    <td align="left">
                                                        <asp:LinkButton ID="btnUpdateEdited" runat="server" OnClick="btnUpdateEdited_click"
                                                            Visible='<%# rg200.EditIndexes.Count > 0 %>'>Update Editing</asp:LinkButton>
                                                            
                                                    </td>
                                                    <td align="left">
                                                        <asp:LinkButton ID="btnCancel" runat="server" OnClick="btnCancel_click" Visible='<%# rg200.EditIndexes.Count > 0 || rg200.MasterTableView.IsItemInserted %>'>Cancel Editing</asp:LinkButton>
                                                            
                                                    </td>
                                                    <td align="right">
                                                        <img style="border: 0px; vertical-align: middle;" alt="" src="Images/AddRecord.gif" />
                                                    </td>
                                                    <td align="left">
                                                        <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# !rg200.MasterTableView.IsItemInserted %>'>Add New Record</asp:LinkButton>
                                                            
                                                    </td>
                                                    <td align="right">
                                                        <img style="border: 0px; vertical-align: middle;" alt="" src="Images/Delete.gif" />
                                                    </td>
                                                    <td align="left">
                                                        <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected Records?')"
                                                            runat="server" CommandName="DeleteSelected">Delete Selected</asp:LinkButton>
                                                            
                                                    </td>
                                                    <td align="right">
                                                        <img style="border: 0px; vertical-align: middle;" alt="" src="Images/Refresh.gif" />
                                                    </td>
                                                    <td align="left">
                                                        <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Rebind">Refresh</asp:LinkButton>
                                                                                 
                                                    </td>
                                                    <td align="left">
                                                        <asp:ImageButton ID="ExportToWordButton" runat="server" ImageUrl="~/images/ExportToWord.gif"
                                                            ToolTip="Export to Word" OnClick="ExportWord_Click" />
                                                           
                                                        <asp:ImageButton ID="ExportToExcelButton" runat="server" ImageUrl="~/images/ExportToExcel.gif"
                                                            ToolTip="Export to Excel" OnClick="ExportExcel_Click" />
                                                            
                                                        <asp:ImageButton ID="ExportToPdfButton" runat="server" ImageUrl="~/images/ExportToPdf.gif"
                                                            ToolTip="Export to Pdf" OnClick="ExportPdf_Click" />
                                                            
                                                        <asp:ImageButton ID="ExportToCsvButton" runat="server" ImageUrl="~/images/ExportToCsv.gif"
                                                            ToolTip="Export to Csv" OnClick="ExportCsv_Click" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </CommandItemTemplate>
                                    <Columns>
                                        <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-Width="3%"
                                            ItemStyle-Width="3%">
                                            <HeaderStyle Width="3%"></HeaderStyle>
                                            <ItemStyle Width="3%"></ItemStyle>
                                        </telerik:GridClientSelectColumn>
                                        <telerik:GridBoundColumn UniqueName="sId" HeaderText="sId" DataField="sId" ReadOnly="true"
                                            Visible="false">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="orderId" HeaderText="orderId" Visible="false"
                                            ReadOnly="true" DataField="orderId">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="Customer Name" HeaderText="Customer Name" DataField="Customer Name"
                                            ReadOnly="true">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="Market Name" HeaderText="Market Name" DataField="Market Name"
                                            ReadOnly="true">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="LOB" HeaderText="LOB" DataField="LOB" ReadOnly="true">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="Headend Name" HeaderText="Headend Name" DataField="Headend Name"
                                            ReadOnly="true">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="Project Name" HeaderText="Project Name" DataField="Project Name"
                                            ReadOnly="true">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridTemplateColumn UniqueName="Site Name" HeaderText="Site Name" DataField="SiteName"
                                            ReadOnly="true">
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lnkSiteName" runat="server" Text='<%# Eval( "Site Name" ) %>'
                                                    ForeColor="Blue" CommandName="sitename"></asp:LinkButton>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridBoundColumn UniqueName="Task Status" HeaderText="Task Status" DataField="Task Status"
                                            ReadOnly="true">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="Clarify Account Nbr" HeaderText="Clarify Account Nbr"
                                            DataField="Clarify Account Nbr">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="Site ID" HeaderText="Site ID" DataField="Site ID">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="Quote ID" HeaderText="Quote ID" DataField="Quote ID">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridCheckBoxColumn UniqueName="EDP Created?" HeaderText="EDP Created?" DataField="EDP Created?">
                                        </telerik:GridCheckBoxColumn>
                                        <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" Visible="false" Display="false">
                                        </telerik:GridEditCommandColumn>
                                    </Columns>
                                    <EditFormSettings EditFormType="Template">
                                        <FormTemplate>
                                            <table id="Table1" cellspacing="1" cellpadding="1">
                                                <tr>
                                                    <td>
                                                        <telerik:RadTabStrip runat="server" ID="RadTabStrip1" Orientation="HorizontalTop"
                                                            SelectedIndex="0" MultiPageID="RadMultiPage1">
                                                            <Tabs>
                                                                <telerik:RadTab Text="Task Data" PageViewID="RadPageView1">
                                                                </telerik:RadTab>
                                                                <telerik:RadTab Text="Notes" PageViewID="RadPageView2">
                                                                </telerik:RadTab>
                                                            </Tabs>
                                                        </telerik:RadTabStrip>
                                                        <telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0">
                                                            <telerik:RadPageView runat="server" ID="RadPageView1">
                                                                <table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0" class="module">
                                                                    <tr>
                                                                        <td>
                                                                        </td>
                                                                        <td>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>
                                                                            Clarify Account Nbr:
                                                                        </td>
                                                                        <td>
                                                                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval( "Clarify Account Nbr" ) %>'>
                                                                            </asp:TextBox>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>
                                                                            Site ID:
                                                                        </td>
                                                                        <td>
                                                                            <asp:TextBox ID="TextBox2" runat="server" Text='<%# Eval( "Site ID") %>' TabIndex="1">
                                                                            </asp:TextBox>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>
                                                                            Quote ID:
                                                                        </td>
                                                                        <td>
                                                                            <asp:TextBox ID="TextBox3" runat="server" Text='<%# Eval( "Quote ID") %>' TabIndex="2">
                                                                            </asp:TextBox>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>
                                                                            EDP Created?:
                                                                        </td>
                                                                        <td>
                                                                            <asp:CheckBox ID="CheckBox1" runat="server" Text='<%# Eval( "EDP Created?") %>' TabIndex="3">
                                                                            </asp:CheckBox>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td align="right" colspan="2">
                                                                            <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                                                                runat="server" CommandName='Update'></asp:Button
                                                                            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                                                                CommandName="Cancel"></asp:Button>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </telerik:RadPageView>
                                                            <telerik:RadPageView runat="server" ID="RadPageView2">
                                                            </telerik:RadPageView>
                                                        </telerik:RadMultiPage>
                                                    </td>
                                                </tr>
                                            </table>
                                        </FormTemplate>
                                    </EditFormSettings>
                                </MasterTableView>
                                <ClientSettings EnableRowHoverStyle="true" ReorderColumnsOnClient="false" AllowDragToGroup="false"
                                    AllowColumnsReorder="True">
                                    <Scrolling AllowScroll="true" EnableVirtualScrollPaging="false" UseStaticHeaders="true" />
                                    <Selecting AllowRowSelect="true"></Selecting>
                                    <Resizing AllowRowResize="true" AllowColumnResize="True" EnableRealTimeResize="True"
                                        ResizeGridOnColumnResize="False"></Resizing>
                                    <ClientEvents OnRowContextMenu="RowContextMenu" OnRowDblClick="RowDblClick"></ClientEvents>
                                </ClientSettings>
                                <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true"></PagerStyle>
                            </telerik:RadGrid>
                        </ContentTemplate>
                    </asp:UpdatePanel>

.cs file

protected void rg216_ItemCommand(object source, GridCommandEventArgs e)
    {
        try
        {
            if (e.CommandName.ToLower() == "sitename")
            {
                GridViewRow rw = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
                Label lblsId = (Label)rw.FindControl("lblsId");
                Label lblorderId = (Label)rw.FindControl("lblorderId");
                Label lblTaskStatus = (Label)rw.FindControl("lblTaskStatus");
                //Label lblsId = (Label)e.Item.FindControl("lblsId");
                //Label lblorderId = (Label)e.Item.FindControl("lblorderId");
                //Label lblTaskStatus = (Label)e.Item.FindControl("lblTaskStatus");
                Session["selorderID"] = lblorderId.Text.Trim();
                Session["selsID"] = lblsId.Text;
                Session["selTaskStatus"] = lblTaskStatus.Text;
                ScriptManager.RegisterClientScriptBlock(this.rg200UpdatePanel, this.GetType(), "strSearSiteName", "document.getElementById('ctl00_PagePlaceholder_ifrmPopups').src='OrdDet.aspx'", true);
                ScriptManager.RegisterClientScriptBlock(this.rg200UpdatePanel, this.GetType(), "open", "openpopup()", true);
                ifrmPopups.Style.Add("height", "409px");
                LinkButton lnkSiteName = (LinkButton)rw.FindControl("lnkSiteName");
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

3 Answers, 1 is accepted

Sort by
0
Babu Puchakayala
Top achievements
Rank 1
answered on 09 Jul 2010, 06:31 PM
Hi,

I solved my first problem by removing radscriptmanager inside the updatepanel and and i solved my second problem also. But the new issue is when i click on link button the radwindow should open. But when i click on the linkbutton i am getting error like

"Microsoft JScript runtime error: '_visibilityMode' is null or not an object"

here is my code and radwindow.

radgrid is as shown above......

this is radwindow code

<asp:UpdatePanel ID="upPopups" runat="server">
            <ContentTemplate>
                <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
                    <Windows>
                        <telerik:RadWindow ID="winPTD" runat="server" ShowContentDuringLoad="false" Width="400px"
                            Height="350px" BackColor="Green" Title="Search" Behaviors="Default" Animation="FlyIn"
                            Skin="Forest">
                            <ContentTemplate>
                                <div style="padding-top: 15px; padding-left: 20px; padding-right: 20px">
                                    <div>
                                        <iframe enableviewstate="false" style="width: 100%; border-style: none; border-width: 0px"
                                            id="ifrmPopups" runat="server"></iframe>
                                    </div>
                                    <asp:UpdateProgress ID="UpdateProgress2" AssociatedUpdatePanelID="upPopups" DisplayAfter="1"
                                        runat="server">
                                        <ProgressTemplate>
                                            <iframe frameborder="0" src="about:blank" class="iframestyle"></iframe>
                                            <div class="iframeDiv">
                                                <img src="Images/rotate_large.gif" alt="" />
                                            </div>
                                            <div>
                                            </div>
                                        </ProgressTemplate>
                                    </asp:UpdateProgress>
                                </div>
                            </ContentTemplate>
                        </telerik:RadWindow>
                    </Windows>
                </telerik:RadWindowManager>
            </ContentTemplate>
        </asp:UpdatePanel>

codebehind

protected void rg216_ItemCommand(object source, GridCommandEventArgs e)
    {
        try
        {
            if (e.CommandName.ToLower() == "sitename")
            {
                GridDataItem dataItem = e.Item as GridDataItem;
                LinkButton lnkButton = (LinkButton)dataItem.FindControl("lnkSiteName");
                string lblsId = dataItem["sId"].Text;
                string lblorderId = dataItem["orderId"].Text;
                string lblTaskStatus = dataItem["Task Status"].Text;
                Session["selorderID"] = lblorderId.Trim();
                Session["selsID"] = lblsId;
                Session["selTaskStatus"] = lblTaskStatus;
                ScriptManager.RegisterClientScriptBlock(this.rg200UpdatePanel, this.GetType(), "strSearSiteName", "document.getElementById('ctl00_PagePlaceholder_winPTD_C_ifrmPopups').src='OrdDet.aspx'", true);
                ScriptManager.RegisterClientScriptBlock(this.rg200UpdatePanel, this.GetType(), "open", "openpopup()", true);
                ifrmPopups.Style.Add("height", "409px");
                 
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

0
Aydın Kara
Top achievements
Rank 1
answered on 23 Jul 2010, 03:10 PM
Same problem. Any suggestions???
0
Babu Puchakayala
Top achievements
Rank 1
answered on 23 Jul 2010, 10:30 PM
Hi Hasan ARSLAN,

Please post the code. I can try...
Tags
Grid
Asked by
Babu Puchakayala
Top achievements
Rank 1
Answers by
Babu Puchakayala
Top achievements
Rank 1
Aydın Kara
Top achievements
Rank 1
Share this question
or