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

How to disable Auto-Generated Edit Form

4 Answers 359 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hans van Rijnswoud
Top achievements
Rank 2
Hans van Rijnswoud asked on 17 Feb 2009, 09:48 AM
Hi,

I have a simple Grid with a gridTemplateColumn with inside 2 asp imageButton who perform specific action.
When i click on this button appear in the grid the auto-generated edit form.
How can i disable this ?
I try to put in the RadGrid definition and in the MasterTableView AllowAutomaticInserts to false but without result.

Here is the definition of my Grid:
<telerik:RadGrid ID="RadGrid1" CssClass="grid" runat="server" Skin="Office2007" 
            GridLines="None" PageSize="10" Height="300px" OnNeedDataSource="RadGrid1_OnNeedDataSource" 
            AutoGenerateColumns="false" ShowFooter="true" AllowAutomaticUpdates="false"  
            AllowAutomaticInserts="false" AllowAutomaticDeletes="false" AutoGenerateEditColumn="false"
            <MasterTableView TableLayout="Fixed" ClientDataKeyNames="AddressID" AutoGenerateColumns="false"  
            Width="100%" AllowAutomaticUpdates="false" AllowAutomaticInserts="false" AllowAutomaticDeletes="false"
                <Columns> 
                    <telerik:GridBoundColumn DataField="AddressId" HeaderText="Id" AllowFiltering="false"
                        <HeaderStyle HorizontalAlign="Left" Width="20" /> 
                        <ItemStyle HorizontalAlign="Left" Width="20" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Naam"
                        <ItemStyle HorizontalAlign="Left" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="AddressTypeObj.Name" HeaderText="Adres type"
                        <ItemStyle HorizontalAlign="Left" /> 
                    </telerik:GridBoundColumn> 
                     <telerik:GridTemplateColumn UniqueName="TemplateActions" AllowFiltering="false"
                        <HeaderTemplate> 
                            <table border="0" cellpadding="0" cellspacing="0"
                                <tr> 
                                    <td colspan="3" align="center"><p>Acties</p></td
                                </tr> 
                            </table> 
                        </HeaderTemplate> 
                        <ItemTemplate> 
                        <table border="0" cellpadding="0" cellspacing="0" width="100%"
                            <tr> 
                                <td style="width:50%; border:0px; text-align:center;"
                                    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
                                        <asp:ImageButton ImageUrl="../Images/edit.gif" AlternateText="Editeren" CausesValidation="false" runat="server" ID="btn_Edit" OnClick="Edit_OnClick" CommandName="Edit" CommandArgument='<%#Eval("AddressId") %>' /> 
                                    </telerik:RadCodeBlock> 
                                </td> 
                                <td style="width:50%; border:0px; text-align:center;"
                                    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server"
                                        <asp:ImageButton ImageUrl="../Images/recyclebin.gif" AlternateText="Verwijderen" CausesValidation="false" runat="server" ID="btn_Delete" OnClick="Delete_OnClick"  CommandName="Edit" CommandArgument='<%#Eval("AddressId") %>' /> 
                                    </telerik:RadCodeBlock> 
                                </td> 
                            </tr> 
                        </table> 
                        </ItemTemplate> 
                        <ItemStyle HorizontalAlign="Center" /> 
                        <HeaderStyle HorizontalAlign="Center" /> 
                    </telerik:GridTemplateColumn> 
                </Columns> 
            </MasterTableView> 
            <PagerStyle Mode="NextPrevAndNumeric" NextPageText="Volgende pagina" PrevPageText="Vorige pagina" NextPagesToolTip="Volgende pagina" PrevPagesToolTip="Vorige pagina" PagerTextFormat="Pagina: {4}  Pagina {0} tot {3} op {5}"  />  
        </telerik:RadGrid> 


Any idee?

Thanks.

Edwin.



4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Feb 2009, 10:04 AM
Hello Edwin,

If you want to show a custom EditForm on clicking the Button then you can set the EditFormType to Template in the EditFormSettings as shown below:
aspx:
 <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server"
     <MasterTableView EditMode="EditForms">        
       <EditFormSettings EditFormType="Template"  > 
        <FormTemplate> 
         
         Custom controls 
          
       </FormTemplate> 
      </EditFormSettings> 
     </MasterTableView> 

Thanks
Princy.
0
Hans van Rijnswoud
Top achievements
Rank 2
answered on 17 Feb 2009, 10:34 AM
Hi Princy,

Thanks for your quick answer but this is not what i want to do.
When I click on my button, I don't want to show the Auto-Generated Edit form inside the grid ( of any other form).
I want nothing ;-)
When I click on my button, i perform well a postback. Maybe I need to add some code to disable this Edit Form?

Thanks,

Edwin.


0
Shinu
Top achievements
Rank 2
answered on 17 Feb 2009, 11:45 AM
Hello Edwin,

If you dont want to display any form on clicking the ImageButton, you would have to change the CommandName of the Button from Edit to some other name. When you set the CommandName to Edit, the grid row automatically opens up in EditMode.

-Shinu.
0
Hans van Rijnswoud
Top achievements
Rank 2
answered on 18 Feb 2009, 10:55 AM
Hi Shinu,

Thank you very much. It was the solution.

Thanks,

Edwin.
Tags
Grid
Asked by
Hans van Rijnswoud
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Hans van Rijnswoud
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Share this question
or