Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET4
<telerik:RadGrid  runat="server" ID="RadGrid1" AutoGenerateColumns="False" 
                AllowPaging="True" CellSpacing="0" GridLines="None" PageSize="2"
                onpageindexchanged="RadGrid1_PageIndexChanged" 
                oneditcommand="RadGrid1_EditCommand"
                oninsertcommand="RadGrid1_InsertCommand" 
                 önupdatecommand="RadGrid1_UpdateCommand" >
                <mastertableview commanditemdisplay="Top" datakeynames="CFM_ID">
                    <columns> 
                    <telerik:gridtemplatecolumn uniquename="TemplateColumn" xmlns:telerik="#unknown">
                        <itemtemplate>                      
                            <asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="false" CommandName="Edit" Text="Edit"/>
                         </itemtemplate>
                        </telerik:gridtemplatecolumn>
 

                        <telerik:gridboundcolumn datafield="CFM_ID" headertext="CustomerFieldID" uniquename="CFM_ID" readonly="true" xmlns:telerik="#unknown" />
                        <telerik:gridboundcolumn datafield="CFM_ID" headertext="CustomerFieldID" uniquename="CFM_ID" readonly="true" xmlns:telerik="#unknown" />
                        <telerik:gridboundcolumn datafield="CFM_Field1" headertext="CustomerField1" uniquename="CFM_Field1" xmlns:telerik="#unknown" />
                        <telerik:gridboundcolumn datafield="CFM_Value1" headertext="CustomerValue1" uniquename="CFM_Value1" xmlns:telerik="#unknown" />
                        <telerik:gridboundcolumn datafield="CFM_Field2" headertext="CustomerField3" uniquename="CFM_Field2" xmlns:telerik="#unknown" />
                        <telerik:gridboundcolumn datafield="CFM_Value2" headertext="CustomerValue2" uniquename="CFM_Value2" xmlns:telerik="#unknown" />
                        <telerik:gridboundcolumn datafield="CFM_Field3" headertext="CustomerField3" uniquename="CFM_Field3" xmlns:telerik="#unknown" />
                        <telerik:gridboundcolumn datafield="CFM_Value3" headertext="CustomerValue3" uniquename="CFM_Value3" xmlns:telerik="#unknown" />
                    
</columns>  
                    <editformsettings editformtype="Template">
                    <FormTemplate>
                        <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none">
                          style="border-collapse: collapse; background: white;"&gt;
                            <tr class="EditFormHeader">
                             <td colspan="2" style="font-size: small">
                                <b>Custom Field Details</b>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0" class="module">
                                    <tr>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                    
                                    <tr>
                                        <td>
                                            CustomField1:
                                        </td>
                                        <td>
                                            &lt;asp:TextBox ID="txtCF1" runat="server" Text='&lt;%# Bind("CFM_Field1") %&gt;' TabIndex="2"&gt;
                                            
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            CustomValue1:
                                        </td>
                                        <td>
                                            &lt;asp:TextBox ID="txtCV1" runat="server" Text='&lt;%# Bind("CFM_Value1") %&gt;' TabIndex="2"&gt;
                                            
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            CustomField1:
                                        </td>
                                        <td>
                                            &lt;asp:TextBox ID="txtCF2" runat="server" Text='&lt;%# Bind("CFM_Field2") %&gt;' TabIndex="2"&gt;
                                            
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            CustomValue2:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtCV2" runat="server" Text='<%# Bind("CFM_Value2") %>' TabIndex="2">
                                            
                                         </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            CustomField3:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtCF3" runat="server" Text='<%# Bind("CFM_Field3") %>' TabIndex="2">
                                            
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            CustomValue3:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtCV3"  runat="server" Text='<%# Bind("CFM_Value3") %>' TabIndex="2">
                                            
                                        </td>
                                    </tr>
                               <tr>
                            <td align="right" colspan="2">
                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                 
                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                     CommandName="Cancel">
                            </td>
                        </tr>
                        <tr>
                        </tr>
                    </table>
                    </FormTemplate>
                       <%-- <asp:TextBox ID="txtID" runat="server" />
                          <asp:TextBox ID="txtField1" runat="server" />
                            <asp:TextBox ID="txtValue1" runat="server" />
                            <asp:TextBox ID="txtField2" runat="server"  />
                            <asp:TextBox ID="txtValue2" runat="server" />
                            <asp:TextBox ID="txtField3" runat="server" />
                            <asp:TextBox ID="txtValue3" runat="server" />--%>
                        
                    </td></tr></table></editformsettings>
                </mastertableview>
***************************
code file:
**********************
 protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
     {
         if (e.Item is GridEditFormItem)
             {
                 GridEditableItem item = (GridEditableItem)e.Item;
                 int id = Convert.ToInt32(item.GetDataKeyValue("CFM_ID"));
                 if (id != 0)
                 {
                     TextBox txtf1 = (TextBox)item.FindControl("txtField1");
                     TextBox txtv1 = (TextBox)item.FindControl("txtValue1");
                     TextBox txtf2 = (TextBox)item.FindControl("txtField2");
                     TextBox txtv2 = (TextBox)item.FindControl("txtValue2");
                     TextBox txtf3 = (TextBox)item.FindControl("txtField3");
                     TextBox txtv3 = (TextBox)item.FindControl("txtValue3");
                     clsCustomFieldMaster objCustom = new clsCustomFieldMaster(); ;
                     objCustom.CFM_Field1 = txtf1.Text;
                     objCustom.CFM_Value1 = txtv1.Text;
                     objCustom.CFM_Field2 = txtf2.Text;
                     objCustom.CFM_Value2 = txtv2.Text;
                     objCustom.CFM_Feild3 = txtf3.Text;
                     objCustom.CFM_Value3 = txtv3.Text;
                     objCustom.SaveRecords(objCustom, true);
 
                     RadGrid1.Rebind();
                 }
             }
}
Posted 27-Sep-12 4:58am
Edited 27-Sep-12 6:01am
v3
Comments
ryanb31 at 27-Sep-12 10:56am
   
Have you checked the Rad site?
Balakrishna2 at 28-Sep-12 9:34am
   
here is the solution When EditFormsettings -- autogenerate:
---------------------------------------------
TextBox txtf1 = item["CFM_Field1"].Controls[0] as TextBox;
TextBox txtv1 = item["CFM_Value1"].Controls[0] as TextBox;
TextBox txtf2 = item["CFM_Field2"].Controls[0] as TextBox;
TextBox txtv2 = item["CFM_Value2"].Controls[0] as TextBox;
TextBox txtf3 = item["CFM_Field3"].Controls[0] as TextBox;
TextBox txtv3 = item["CFM_Value3"].Controls[0] as TextBox;
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

1. You just posted the code! You were not too specific on what's troubling you.
 
2. Please have a look at the Rad Documentation. I just think, posting such issues about a 3rd party control would be more useful at their respective forums. Try here:Telerik Forum[^]
 
Also look here: Telerik RadGrid Forum[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

refer these liks
*********************************************************
When EditFormsettings -- autogenerate:
***********************************************************
http://www.telerik.com/help/aspnet-ajax/grid-accessing-cells-and-rows.html[^]
******************************
 
http://www.telerik.com/community/forums/aspnet-ajax/grid/get-value-of-gridboundcolumn-in-gridtableview.aspx[^]
*******************
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 175
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 28 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100