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

RadDock with RadGrid inside User Control

1 Answer 110 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Simone
Top achievements
Rank 1
Simone asked on 23 Sep 2011, 09:24 PM
INSERTCOMMAND in a RadGrid inside a Raddock is not firing!

I have a RadGrid inside a RadDock. I am doing some updating/inserting built in the RadGrid.

The RadGrid's ItemCommand fires ok when clicking to INIT insert.

However the ItemCommand, UpdateCommand / InsertCommand ARE NOT FIRING when clicking to perform Insert.
They fire OK if I just put the grid on the page (without the raddock), it works fine, but they won't fire if the grid is inside the raddock.

I need to know why this is happening.

Thanks,
Simone

 

 Source:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="WebForm4.aspx.cs" Inherits="SMTPro.WebForm4" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadDockLayout runat="server" EnableViewState="false" ID="RadDockLayout1"
        StoreLayoutInViewState="false">
        <telerik:RadDock ID="rdRepAds" runat="server" Title="Ads" Width="600px" EnableAnimation="true"
            Skin="Office2010Silver" EnableRoundedCorners="true" Resizable="true" AutoPostBack="true">
            <ContentTemplate>
                <telerik:RadGrid ID="grdRepAds" runat="server" CellSpacing="0" GridLines="None" PageSize="20"
                    EnableViewState="true" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True"
                    OnItemCommand="grdRepAds_ItemCommand" OnItemDataBound="grdRepAds_ItemDataBound"
                    OnInsertCommand="grdRepAds_InsertCommand">
                    <ClientSettings>
                        <Selecting AllowRowSelect="True" />
                    </ClientSettings>
                    <MasterTableView DataKeyNames="ID" CommandItemDisplay="Bottom" AutoGenerateColumns="False"
                        FilterExpression="Active = true">
                        <CommandItemTemplate>
                            <asp:LinkButton ID="btnInitInsert" runat="server" CommandName="InitInsert"><img style="border:0px;vertical-align:middle;" alt="" src="Images/AddRecord.gif" />Add new&nbsp;&nbsp;&nbsp;&nbsp;</asp:LinkButton>
                        </CommandItemTemplate>
                        <Columns>
                            <telerik:GridBoundColumn DataField="RepID" FilterControlWidth="130" HeaderText="RepID">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="AdID" FilterControlWidth="130" HeaderText="AdID">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                    </HeaderContextMenu>
                </telerik:RadGrid>
            </ContentTemplate>
        </telerik:RadDock>
    </telerik:RadDockLayout>
</asp:Content>


 

 =============

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                using (var db = new mockupEntities())
                {
                    int repID;
                    repID = 7784;
                    var query = from sr in db.RepAds
                                where sr.RepID == repID
                                select sr;

                    grdRepAds.DataSource = query.ToList();
                    Session["dsRepAdsByRepID"] = query.ToList();
                }
            }
            else
            {
                grdRepAds.DataSource = Session["dsRepAdsByRepID"];
            }
        }

        protected void grdRepAds_ItemCommand(object sender, GridCommandEventArgs e)
        {
        }

        protected void grdRepAds_ItemDataBound(object sender, GridItemEventArgs e)
        {
        }

        protected void grdRepAds_InsertCommand(object sender, GridCommandEventArgs e)
        {
            //does not fire!!!!!!!!!
        }

 

1 Answer, 1 is accepted

Sort by
0
Simone
Top achievements
Rank 1
answered on 26 Sep 2011, 04:31 PM
Never mind. I figured out. I had "enableviewstate=false" set, I just turned it off and it seems to be working now.
Tags
Dock
Asked by
Simone
Top achievements
Rank 1
Answers by
Simone
Top achievements
Rank 1
Share this question
or