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

Get values of FormTemplate to EditFormSettings

1 Answer 165 Views
Documentation and Tutorials
This is a migrated thread and some comments may be shown as answers.
Erick
Top achievements
Rank 1
Erick asked on 11 Jun 2019, 03:54 PM

How is the best way to get values of controls to EditFormSettings ?

I have this code but I don't know if there's other best way:

 

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
       {
           if (e.CommandName == "PerformInsert")
           {
               GridEditFormInsertItem editform = (GridEditFormInsertItem)((Telerik.Web.UI.GridEditFormInsertItem)(e.Item));
               RadTextBox txtbx = (RadTextBox)editform.FindControl("txtName");
               string strtxt = txtbx.Text;
           }
       }
<EditFormSettings EditFormType="Template">
     <FormTemplate>
           <telerik:RadLabel runat="server" Text="Name:" Font-Bold="True"></telerik:RadLabel>
           <br />
           <telerik:RadTextBox ID="txtName" runat="server" InputType="Text" MaxLength="70" Width="100%" AutoCompleteType="None" autocomplete="off"></telerik:RadTextBox>
           <asp:RequiredFieldValidator ErrorMessage="*" ControlToValidate="txtName" runat="server" CssClass="rfv" />
           <telerik:RadButton ID="btnSave" runat="server" Text='<%# (Container is GridEditFormInsertItem) ? "Save" : "Update" %>'CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'> </telerik:RadButton>
     </FormTemplate>
</EditFormSettings>

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 14 Jun 2019, 10:50 AM
Hello Erick,

Yes, this approach is correct by general:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/database-level-editing

You can also use the Bind expression in the mark-up code and then extract the values using ExtractValues method:
-  https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/manual-crud-operations/defaultcs.aspx
-  https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/form-template-update/defaultcs.aspx

I hope this will prove helpful.

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Documentation and Tutorials
Asked by
Erick
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or