This is a migrated thread and some comments may be shown as answers.
Cancel button not canceling
3 Answers 48 Views
This is a migrated thread and some comments may be shown as answers.
Jon-Jon Kershaw
Top achievements
Rank 2
Jon-Jon Kershaw asked on 19 May 2009, 05:24 PM


<
%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucViewEditSearchEntry.ascx.cs" 
    Inherits="uc_View_Edit_Search_Entry" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<div> 
 
    <br /> 
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 
    &nbsp;  
    <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> 
    <telerik:RadGrid ID="rgViewEditSearchEntry" runat="server" AllowFilteringByColumn="True" 
        AllowSorting="True" GroupingSettings-CaseSensitive="false" PageSize="20" GridLines="None" 
        AutoGenerateColumns="False" DataSourceID="SqlRxLog" OnPageIndexChanged="rgViewEditSearchEntry_PageIndexChanged" 
        AllowPaging="True" ShowStatusBar="True" AllowAutomaticDeletes="True" OnItemDeleted="rgViewEditSearchEntry_ItemDeleted" 
        OnItemCancel="rgViewEditSearchEntry_ItemCancel" 
        > 
        <HeaderContextMenu EnableTheming="True">  
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        </HeaderContextMenu> 
        <PagerStyle Mode="NextPrevAndNumeric" /> 
        <MasterTableView DataKeyNames="Id" DataSourceID="SqlRxLog" ShowFooter="False" CommandItemSettings-AddNewRecordText="Add New Contact" 
            CommandItemDisplay="TopAndBottom">  
            <CommandItemSettings AddNewRecordText="Add New Blocked Account"></CommandItemSettings> 
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridTemplateColumn UniqueName="EditColumn" ItemStyle-Width="16px" AllowFiltering="false">  
                    <HeaderStyle Width="10px" /> 
                    <ItemTemplate> 
                        <asp:ImageButton ID="imgbtnEdit" ToolTip="Edit Contact" runat="server" CommandName="Edit" 
                            ImageUrl="~/images/magnifying.jpg" Width="15px" /> 
                    </ItemTemplate> 
                    <ItemStyle Width="10px"></ItemStyle> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn UniqueName="DeleteColumn" ItemStyle-Width="16px" AllowFiltering="false">  
                    <HeaderStyle Width="10px" /> 
                    <ItemTemplate> 
                        <asp:ImageButton ID="imgbtnDelete" ToolTip="Delete Contact" runat="server" CommandName="Delete" 
                            ImageUrl="~/images/recycle.jpg" Width="15px" OnClientClick="javascript:if(!confirm('This action will delete the selected contact. Are you sure?')){return false;}" /> 
                    </ItemTemplate> 
                    <ItemStyle Width="10px"></ItemStyle> 
                </telerik:GridTemplateColumn> 
                <telerik:GridBoundColumn DataField="Id" DataType="System.Int32" HeaderText="Id" ReadOnly="True" 
                    SortExpression="Id" UniqueName="Id" FilterControlWidth="20px">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="DNIS" HeaderText="DNIS" SortExpression="DNIS" 
                    UniqueName="DNIS" FilterControlWidth="30px">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Prefix" HeaderText="Prefix" SortExpression="Prefix" 
                    UniqueName="Prefix" FilterControlWidth="30px">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Panel_Code" HeaderText="Panel_Code" SortExpression="Panel_Code" 
                    UniqueName="Panel_Code" FilterControlWidth="30px">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Premise_Phone" HeaderText="Premise_Phone" SortExpression="Premise_Phone" 
                    UniqueName="Premise_Phone">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Toll_Free_Number" HeaderText="Toll_Free_Number" 
                    SortExpression="Toll_Free_Number" UniqueName="Toll_Free_Number">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Date_Blocked" DataType="System.DateTime" HeaderText="Date_Blocked" 
                    SortExpression="Date_Blocked" UniqueName="Date_Blocked">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="CS_Number" HeaderText="CS_Number" SortExpression="CS_Number" 
                    UniqueName="CS_Number">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Comments" HeaderText="Comments" SortExpression="Comments" 
                    UniqueName="Comments">  
                </telerik:GridBoundColumn> 
            </Columns> 
            <EditFormSettings EditFormType="Template">  
                <EditColumn UniqueName="EditCommandColumn1">  
                </EditColumn> 
                <FormTemplate> 
                    <asp:Table ID="tbSingleEntry" runat="server">  
                        <asp:TableRow> 
                            <asp:TableCell ColumnSpan="2" HorizontalAlign="center">  
                                <asp:Label ID="lblHeaderTitle" runat="server" Text="Single Entry Block Account"></asp:Label> 
                            </asp:TableCell> 
                        </asp:TableRow> 
                        <asp:TableRow> 
                            <asp:TableCell> 
                                <asp:Label ID="lblDNIS" runat="server" Text="DNIS:"></asp:Label> 
                            </asp:TableCell> 
                            <asp:TableCell> 
                                <asp:TextBox ID="txtDNIS" runat="server"></asp:TextBox> 
                            </asp:TableCell> 
                        </asp:TableRow> 
                        <asp:TableRow> 
                            <asp:TableCell> 
                                <asp:Label ID="lblPrefix" runat="server" Text="Prefix:"></asp:Label> 
                            </asp:TableCell> 
                            <asp:TableCell> 
                                <asp:TextBox ID="txtPrefix" runat="server"></asp:TextBox> 
                            </asp:TableCell> 
                        </asp:TableRow> 
                        <asp:TableRow> 
                            <asp:TableCell> 
                                <asp:Label ID="lblPanelCode" runat="server" Text="Panel Code:"></asp:Label> 
                            </asp:TableCell> 
                            <asp:TableCell> 
                                <asp:TextBox ID="txtPanelCode" runat="server"></asp:TextBox> 
                            </asp:TableCell> 
                        </asp:TableRow> 
                        <asp:TableRow> 
                            <asp:TableCell> 
                                <asp:Label ID="lblPremisePhone" runat="server" Text="Premise Phone:"></asp:Label> 
                            </asp:TableCell> 
                            <asp:TableCell> 
                                <asp:TextBox ID="txtPremisePhone" runat="server"></asp:TextBox> 
                            </asp:TableCell> 
                        </asp:TableRow> 
                        <asp:TableRow> 
                            <asp:TableCell> 
                                <asp:Label ID="lblTollFreeNumber" runat="server" Text="Toll Free Number:"></asp:Label> 
                            </asp:TableCell> 
                            <asp:TableCell> 
                                <asp:TextBox ID="txtTollFreeNum" runat="server"></asp:TextBox> 
                            </asp:TableCell> 
                        </asp:TableRow> 
                        <asp:TableRow> 
                            <asp:TableCell> 
                                <asp:Label ID="lblDateBlocked" runat="server" Text="Date Blocked:"></asp:Label> 
                            </asp:TableCell> 
                            <asp:TableCell> 
                                <asp:TextBox ID="txtDateBlocked" runat="server"></asp:TextBox> 
                            </asp:TableCell> 
                        </asp:TableRow> 
                        <asp:TableRow> 
                            <asp:TableCell> 
                                <asp:Label ID="lblCSNumber" runat="server" Text="CS Number:"></asp:Label> 
                            </asp:TableCell> 
                            <asp:TableCell> 
                                <asp:TextBox ID="txtCSNumber" runat="server"></asp:TextBox> 
                            </asp:TableCell> 
                        </asp:TableRow> 
                        <asp:TableRow> 
                            <asp:TableCell> 
                                <asp:Label ID="lblComments" runat="server" Text="Comments:"></asp:Label> 
                            </asp:TableCell> 
                            <asp:TableCell> 
                                <asp:TextBox ID="txtComments" runat="server"></asp:TextBox> 
                            </asp:TableCell> 
                        </asp:TableRow> 
                        <asp:TableRow> 
                            <asp:TableCell>          
                            </asp:TableCell> 
                            <asp:TableCell> 
                            </asp:TableCell> 
                        </asp:TableRow> 
                    </asp:Table> 
                    <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 
                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>  
                    </asp:Button>&nbsp;<asp:Button ID="btnCancel" runat="server" Text="Cancel"   
                        CommandName="Cancel"/>  
                    </td> 
                    <br /> 
                </FormTemplate> 
            </EditFormSettings> 
        </MasterTableView> 
 
<GroupingSettings CaseSensitive="False"></GroupingSettings> 
 
        <FilterMenu EnableTheming="True">  
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        </FilterMenu> 
    </telerik:RadGrid> 
    <asp:SqlDataSource ID="SqlRxLog" runat="server" ConnectionString="<%$ ConnectionStrings:RxLogConnectionString %>" 
        SelectCommand="SELECT * FROM [BlokedAcc]"></asp:SqlDataSource> 
</div> 
 

Simple button within radgrid masterformview that is supposed to just close the template when hit the cancel button but doesn't?



3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 20 May 2009, 05:57 AM
Hi Jon,

Can you try replacing the pushbutton in the FormTemplate with a linkbutton with CommandName as Cancel and see whether it is closing the edit form.

 
      <asp:LinkButton ID="LinkButton1" runat="server" Text="Cancel" CommandName="Cancel"  ></asp:LinkButton> 


Shinu
0
Jon-Jon Kershaw
Top achievements
Rank 2
answered on 20 May 2009, 03:49 PM
thanks!
0
Prashant
Top achievements
Rank 1
answered on 18 Apr 2013, 12:56 PM
I have used Telerik Grid Razor Syntax. I have used Dynamic Viewmodel to bind the grid. I have buttons on the grid. On clicking Edit button, I am able to edit the entire row. But when i click cancel. The entire row dissappears. I am attaching the project with this query.
Tags
Grid
Asked by
Jon-Jon Kershaw
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 1
Jon-Jon Kershaw
Top achievements
Rank 2
Prashant
Top achievements
Rank 1
Share this question
or