I am trying to get the values from the RadGrid insert form and then insert those values from the form elements into a SQL database using a stored procedure. When I run the following code using the RadGrid insert command sub, empty values are inserted to the database.
Here is the code:
Protected Sub rg_InsertCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles rg.InsertCommand
Dim item As GridEditFormInsertItem = CType(e.Item, GridEditFormInsertItem)
Dim name As RadTextBox = TryCast(item.FindControl("txtName"), RadTextBox)
Dim str As String = name.Text
3 Answers, 1 is accepted
answered on 13 Nov 2019, 03:46 PM
The VB code you've showed me looks to be correct. If the RadTextBox's value is empty at this event (InsertCommand), most likely the Controls is not being bound to the template.
Can you double check and ensure that RadTextBox's Text property is bound as shown in the following example?
If this is done and the value is still not present at InsertCommand, please share the RadGrid markup and code behind code so that I can check out how the entire configuration looks like and advise you based on that.
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.