6 Answers, 1 is accepted
Hi Wally,
Similar to the Data Binding Selected Value forum thread, the RadTextBox must also have the Bind() expression defined or otherwise the RadDataForm will not pick up the introduced values.
<telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Bind("SomeFieldInTheDatabase") %>''></telerik:RadTextBox>
Regards,
Doncho
Progress Telerik
The Bind() statement wasn't the question. I clearly state that I'm able to send data to the database having just the RadTextBox within the Div. The default-generated templates do this. However, what I'm trying to do is embed the RadTextBox within an ASP Table to have more control over the layout. Something like this:
<
asp:Table
runat
=
"server"
>
<
asp:TableRow
>
<
asp:TableCell
>
<
telerik:RadTextBox
ID
=
"RadTextBox1"
runat
=
"server"
Text='<%# Bind("SomeFieldInTheDatabase") %>' />
</
asp:TableCell
>
</
asp:TableRow
>
</
asp:Table
>
That does not write the value entered into the RadTextBox into the database. It's as if the control and its value are not seen when clicking the Update button.
Hi Wally,
Would you explain what did you mean by "default-generated templates"? We may have examples with some templates, but there is no explicit default. Can you tell me more about, or show me those templates?
When working with Templates, the Bind() is necessary for the Controls to pick up the values entered by the user. Otherwise, that will not happen.
Here is an example showing that
Assuming that we have the following DataForm structure. I am only displaying the important part.
<telerik:RadDataForm runat="server" ID="RadDataForm1" OnItemUpdating="RadDataForm1_ItemUpdating">
<LayoutTemplate>
<%--pager and layout here--%>
</LayoutTemplate>
<ItemTemplate>
<%--some controls here--%>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadTextBox ID="RadTextBox1" runat="server"></telerik:RadTextBox>
</EditItemTemplate>
</telerik:RadDataForm>
In this case, if I fill the textbox and click on Update, the values will not be present on the server-side.
Debugging code on the server shows no values:
If, however, I bind the RadTextBox using the server-side Bind() expression like in the code snippet below:
<EditItemTemplate>
<telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Bind("SomeFieldName") %>'></telerik:RadTextBox>
</EditItemTemplate>
and then updating the form like this
Server-Side Debugging shows the values present on the server:
Embedding the RadTextBox in a table like shown below, doesn't change the behavior and the binding will still be working
<EditItemTemplate>
<asp:Table ID="Table1" runat="server">
<asp:TableRow>
<asp:TableCell>
<telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Bind("ShipName") %>'></telerik:RadTextBox>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</EditItemTemplate>
It would be very helpful if you could share more information about the current structure, the way you bind data to the DataForm and the server-side code if doing Manual CRUD operations.
Kind regards,
Doncho
Progress Telerik
Hello Wally,
The ConflictDetection property of the SqlDataSource is related to how the SQL Update is performed, its an action between SqlDataSource and the database. This property defines whether conflicts should be detected before the operation is completed.
On the other hand, using ASP Tables, or HTML tables, and whether they are placed inside Telerik RadDataForm or ASP DataForm, they are rather related to HTML Structure and have no impact on how the SQL operation is being performed.
I advise that you check out the official documentation to get a better understanding: SqlDataSource.ConflictDetection Property
Kind regards,
Doncho
Progress Telerik