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

UserControl Edit - Cancel Not Firing

1 Answer 164 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Baatezu asked on 20 Jan 2008, 08:17 AM
I'm pretty new to Telerik, and I've researched this problem for a few days and none of the solutions I've found have worked for me.
I'm using DotNetNuke 4.8.0, VS2008 ( RTM). Tested in FF and IE 7.0.6000. This is running on my local Vista Ultimate machine with IIS 7.0.6000. I am using .netTiers as my DAL.
I'm using the trial version - ASP.NET Q3 2007 SP1 (Version Number 2007.3.1314

What my problem is - When I click Update or Cancel, it doesn't close the edit form. The page does a postback, but the edit form is still open. I don't notice any Events firing that are firing as a result of the Cancel button, just those of a page reloading.
If I don't use a custom edit form, the default Cancel operates normally.

Any pointers would be great, I assume I'm missing something simple; I just can't see it.
Both the Edit Control and the Control with the Grid on it are posted in full below.


My ascx with the Grid control is
<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="ViewTestModule.ascx.cs" Inherits="GS_Marketplace.DotNetNuke.Modules.TestModule.ViewTestModule" %> 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
<asp:Label ID="lblDebug" runat="server">Vroom?</asp:Label> 
<telerik:RadGrid Skin="WebBlue" ID="RadGrid1" runat="server" 
            GridLines="None" AllowPaging="True" AllowSorting="True"  
    Width="97%" AutoGenerateColumns="False" ShowStatusBar="True"  
    <MasterTableView EnableViewState="True" EnableColumnsViewState="True" CurrentResetPageIndexAction="SetPageIndexToFirst" DataKeyNames="GenderTypeID" 
            Frame="Border" TableLayout="Auto" CommandItemDisplay="Top"
        <RowIndicatorColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" Visible="False"
            <HeaderStyle Width="20px"></HeaderStyle> 
        <ExpandCollapseColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" Visible="False" Resizable="False"
            <HeaderStyle Width="20px"></HeaderStyle> 
            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"></telerik:GridEditCommandColumn> 
            <telerik:GridBoundColumn UniqueName="GenderTypeID" HeaderText="ID" DataField="GenderTypeID"></telerik:GridBoundColumn> 
            <telerik:GridBoundColumn UniqueName="Description" HeaderText="Description" DataField="Description"></telerik:GridBoundColumn> 
            <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete" /> 
        <EditFormSettings UserControlName="~/DesktopModules/Goldstar Consulting.TestModule/TestAddControl.ascx" EditFormType="WebUserControl"
            <EditColumn UniqueName="EditCommandColumn1"></EditColumn> 

My UserControl edit ascx is
<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="TestAddControl.ascx.cs" Inherits="GS_Marketplace.DotNetNuke.Modules.TestModule.TestAddControl" %> 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
<asp:Label ID="lblDebug" runat="server"></asp:Label> 
    <telerik:RadTextBox EnableViewState="True" ID="RadTextBox1" Runat="server"  
        EmptyMessage="New Gender Type" Label="Gender" Text='<%# DataBinder.Eval(Container, "DataItem.Description") %>'  
        TextMode="SingleLine" Height="20px" Width="237px"
<div align="right"
    <asp:button EnableViewState="True" id="btnUpdate" text="Update" runat="server" CommandName="Update" Visible='<%# !(Container is Telerik.Web.UI.GridInsertionObject) %>'></asp:button> 
            <asp:button  EnableViewState="True" id="btnInsert" text="Insert" runat="server" CommandName="PerformInsert" Visible='<%# Container is Telerik.Web.UI.GridInsertionObject %>'></asp:button> 
            <asp:button  EnableViewState="True" id="btnCancel" text="Cancel" runat="server" causesvalidation="False" commandname="Cancel"></asp:button> 
The only thing I have in the code is some simple DataBinding in PageLoad
 protected void Page_Load(object sender, EventArgs e) 
                if (!IsPostBack) 
                GenderTypeService genderTypeService = new GenderTypeService(); 
                int totalCount = 0; 
                TList<GenderType> genderTypeList = genderTypeService.GetPaged(GenderTypeColumn.Deleted + " = 'false'", GenderTypeColumn.GenderTypeId.ToString(), 0, 10, out totalCount); 
                RadGrid1.DataSource = genderTypeList.ToDataSet(false); 
            catch (Exception ex) 
                Exceptions.ProcessModuleLoadException(this, ex); 

1 Answer, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 22 Jan 2008, 03:11 PM
Baatezu, I see that you have DataBind() calls and bind the grid to data only on initial load. Data editing should be supported without additional coding if you supply the data source for the grid inside the NeedDataSource event handler:

Online demo

Revise your code to see how it goes.

Asked by
Top achievements
Rank 2
Answers by
Top achievements
Rank 1
Share this question