hi
excuse for my english "am french"
I test your telerik datagrid with usercontrol insert/update/delete exemple
and all work well with simple word
but when i trie to update a value with ' quote ex: l'organisation it impossible to send this value.
i think it a concatenation problem
my code
usercontrol.ascx :
can you help me I don't see where is the error.
excuse for my english "am french"
I test your telerik datagrid with usercontrol insert/update/delete exemple
and all work well with simple word
but when i trie to update a value with ' quote ex: l'organisation it impossible to send this value.
i think it a concatenation problem
my code
usercontrol.ascx :
| <asp:TextBox ID="AssoPresident" runat="server" Width="260px" Text='<%# DataBinder.Eval( Container, "DataItem.AssoPresident" ) %>'></asp:TextBox> |
default.aspx (code behind) :
| Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGrid1.UpdateCommand |
| Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem) |
| Dim MyUserControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl) |
| 'Get the primary key value using the DataKeyValue. |
| Dim AssoID As String = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("AssoID").ToString() |
| 'Access the textbox from the edit form template and store the values in string variables. |
| 'Dim AssoNom As String = (TryCast(editedItem.FindControl("RadTextNom"), RadTextBox)).Text |
| Dim AssoPresident As String = CType(MyUserControl.FindControl("AssoPresident"), TextBox).Text |
| 'Dim PetitDescriptif As String = CType(userControl.FindControl("PetitDescriptif"), TextBox).Text |
| Try |
| 'Open the SqlConnection |
| SqlConnection.Open() |
| 'Update Query to update the Datatable |
| Dim updateQuery As String = "UPDATE association set AssoPresident='" & AssoPresident & "' where AssoID='" & AssoID & "'" |
| SqlCommand.CommandText = updateQuery |
| SqlCommand.Connection = SqlConnection |
| SqlCommand.ExecuteNonQuery() |
| 'Close the SqlConnection |
| SqlConnection.Close() |
| Catch ex As Exception |
| RadGrid1.Controls.Add(New LiteralControl("Unable to update Customers. Reason: " + ex.Message)) |
| e.Canceled = True |
| End Try |
| End Sub |
can you help me I don't see where is the error.