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

RadGrid Edit Mode, Insert button causes validation

1 Answer 231 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ThePope
Top achievements
Rank 1
ThePope asked on 25 Nov 2008, 03:21 PM
Hello,
    When using a radgrid in edit mode, clicking the insert button causes the page to validate. Is there a way to turn this off? I have a multi-tab configuration page, and I need to be able to add items to the radgrid using the built in "add new item" functionality, without forcing the rest of the pages to be valid when the item is inserted. I have tried defining a custom edit form setting causesvalidation="false" on the insert button, but that does not work.

<radG:RadGrid ID="rgCampaignTypes"  Skin="MTCDefault_Small_EditInPlace" EnableAJAX="false" EnableAJAXLoadingTemplate="false" runat="server"   
AllowAutomaticDeletes="True" AllowAutomaticInserts="True" Width="100%" PageSize="20" AllowMultiRowSelection="false"   
AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False" ShowStatusBar="False" AllowMultiRowEdit="False">  
<PagerStyle Mode="NextPrevAndNumeric"  /> 
<ClientSettings> 
   <Resizing allowColumnResize="true" />                                              
</ClientSettings> 
<MasterTableView Height="150px" NoMasterRecordsText="No Campaign Types have been defined."   
Width="100%" CommandItemDisplay="Top" HorizontalAlign="NotSet" AutoGenerateColumns="False">                                                     <CommandItemSettings AddNewRecordText="Add New Campaign Type" /> 
<Columns> 
   <radG:GridButtonColumn UniqueName="DeleteColumn" ButtonType="ImageButton" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="45px" HeaderText="Delete" CommandName="Delete" ImageUrl="~/RadControls/Grid/Skins/MTCDefault/Delete-account-16.gif">  
   </radG:GridButtonColumn> 
   <radG:GridEditCommandColumn EditImageUrl="~/RadControls/Grid/Skins/MTCDefault/edit-16.gif" UniqueName="EditCommandColumn" ButtonType="ImageButton"  HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="45px" HeaderText="Edit">  
   </radG:GridEditCommandColumn> 
   <radG:GridBoundColumn UniqueName="CampaignTypeName" DataField="TypeName" HeaderText="Campaign Type"></radG:GridBoundColumn>                                                       <radG:GridBoundColumn UniqueName="CampaignTypeID" DataField="CampaignTypeID" Visible="False" ReadOnly="True">  
   </radG:GridBoundColumn> 
</Columns> 
<EditFormSettings EditFormType="Template">  
<FormTableItemStyle width="100%"></FormTableItemStyle> 
<FormTableStyle GridLines="None" CellSpacing="0" CellPadding="2"></FormTableStyle> 
<FormStyle Width="100%" backColor="white"></FormStyle> 
<EditColumn UniqueName="EditCommandColumn1"></EditColumn> 
<FormTemplate> 
    <asp:Table runat="Server">  
        <asp:TableRow> 
            <asp:TableCell> 
                <asp:TextBox id="txtCampaignTypeName" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.TypeName" ) %>'></asp:TextBox> 
            </asp:TableCell> 
        </asp:TableRow> 
        <asp:TableRow> 
            <asp:TableCell> 
                <asp:button id="btnInsert" text="Insert" CssClass="button" runat="server" CausesValidation="false" commandname="PerformInsert">  
                </asp:button>&nbsp;  
                <asp:button id="btnCancel" text="Cancel" CssClass="button" runat="server" causesvalidation="False"                                                                            commandname="Cancel"></asp:button>   
            </asp:TableCell> 
        </asp:TableRow> 
    </asp:Table> 
</FormTemplate> 
</EditFormSettings> 
</MasterTableView> 
</radG:RadGrid> 


Any ideas?

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 27 Nov 2008, 12:54 PM
Hi,

To see more information on possible ways to handle this scenario, please take a look at the following example.
I hope it gets you started properly!

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
ThePope
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or