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

Error while using RadGrid

2 Answers 55 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
Satbir
Top achievements
Rank 1
Satbir asked on 31 May 2013, 11:38 AM

Hi All,
I am trying to use RadGrid in a user control in sharepoint 2007 project. But when the grid is loaded, it generates a javascript error stating "Object Required, Line1 Char1".

When i click on edit button to edit my grid row, the control does not enter radGrid_ItemDataBound method. and hence the grid does not appear in edit mode. But it does execute radGrid_ItemCommand method. Only after clicking a button that causes postback event, the edit mode gridrow appears but without any data.

I am using a master page for the usercontrol
Following is the code
Master page code:

<%@ Register Assembly="Telerik.Web.UI, Version=****.*.****.**, Culture=neutral, PublicKeyToken=********"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

I have added RadAjaxManager in the master page.

<telerik:RadAjaxManager ID="AjaxManager1" runat="server"></telerik:RadAjaxManager>
UserControl.ascx
<%@ Register Assembly="Telerik.Web.UI, Version=****.*.****.**, Culture=neutral, PublicKeyToken=*********"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
……………………..
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Windows7"
    MinDisplayTime="30" />
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rgReportEditor">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rgReportEditor" />
                <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
  
<table>
.....
.....
     <telerik:RadGrid ID="rgReportEditor" Skin="Windows7" GridLines="None" ItemStyle-BackColor="White"
                AlternatingItemStyle-BackColor="#EFEFEF" runat="server" AutoGenerateColumns="False"
                SelectedItemStyle-BackColor="blue" OnUpdateCommand="rgReportEditor_UpdateCommand"
                OnItemCommand="rgReportEditor_ItemCommand" OnEditCommand="rgReportEditor_EditCommand"
                OnItemDataBound="rgReportEditor_ItemDataBound">
                <MasterTableView InsertItemDisplay="Bottom" HorizontalAlign="NotSet" EditMode="InPlace"
                    TableLayout="Fixed" Frame="Border">
                    <HeaderStyle Font-Bold="true" BackColor="#BDBDBD" ForeColor="Black" />
                    <PagerStyle AlwaysVisible="true" />
                    <Columns>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditColumn">
                            <ItemStyle CssClass="MyImageButton" Width="7%" />
                            <HeaderStyle Width="7%" />
                        </telerik:GridEditCommandColumn>
                        <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Testing column">
                            <ItemStyle Width="17%" />
                            <HeaderStyle Width="17%" />
                            <ItemTemplate>
                                <asp:Label ID="lblValue" runat="server"></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <%-- <telerik:RadComboBox ID="cboReportEditorColumn" Width="100%" runat="server" Skin="Office2007">
                                    </telerik:RadComboBox>--%>
                                <asp:DropDownList ID="ddlValue" runat="server">
                                </asp:DropDownList>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <%-- <telerik:GridButtonColumn ConfirmText="Delete this entry?" ConfirmDialogType="RadWindow"
                                ConfirmTitle="Attention" ConfirmDialogHeight="100" ConfirmDialogWidth="250" ButtonType="ImageButton"
                                CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" CommandArgument="Code">
                                <ItemStyle CssClass="MyImageButton" Width="3%" />
                                <HeaderStyle Width="3%" />
                            </telerik:GridButtonColumn>--%>
                    </Columns>
                </MasterTableView>
                <ClientSettings AllowColumnHide="True">
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                    <Resizing AllowColumnResize="True" EnableRealTimeResize="false" />
                </ClientSettings>
            </telerik:RadGrid>
  
.........
</table>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
</telerik:RadWindowManager>

UserControl.ascx.cs

protected void Page_Load(object sender, EventArgs e)
        {
  
                RadAjaxManager objRadAJAXManager = RadAjaxManager.GetCurrent(Page);
                objRadAJAXManager.ClientEvents.OnRequestStart = "onRequestStart";
                objRadAJAXManager.AjaxSettings.AddAjaxSetting(rgReportEditor, rgReportEditor, RadAjaxLoadingPanel1);
                objRadAJAXManager.AjaxSettings.AddAjaxSetting(rgReportEditor, RadWindowManager1, RadAjaxLoadingPanel1);
                objRadAJAXManager.AjaxSettings.AddAjaxSetting(rgReportEditor, lblErrorYAxis);
  
    .................................................................
    .................................................................
    .................................................................
     }

Please  suggest how to make the grid work in edit mode.

Thanks,
Satbir










2 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 04 Jun 2013, 07:57 AM
Hello Satbir,

Following the scenario I have created a test website in an attempt to reproduce the problem described but was unable to do so. Please review the attachment and tell us what differs in your case? Also from the code I noticed that a particular AJAX setting is added twice. Once declaratively and once programmatically in the Page_Load event handler. Please remove one of the definitions. Finally, I would like you to elaborate more on the exact version of the controls used in the project. Maybe this was a bug in the previous versions. Please upgrade and test whether the problem still replicates.

Regards,
Angel Petrov
Telerik

Consider using RadControls for ASP.NET AJAX (built on top of the ASP.NET AJAX framework) as a replacement for the Telerik ASP.NET Classic controls, See the product support lifecycle here.

0
Satbir
Top achievements
Rank 1
answered on 04 Jun 2013, 01:31 PM
Thanks, will try what you suggested.
Tags
Sharepoint Integration
Asked by
Satbir
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Satbir
Top achievements
Rank 1
Share this question
or