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

Grid for ASP.NET AJAX will not update sql db

1 Answer 15 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dharmesh Patel
Top achievements
Rank 1
Dharmesh Patel asked on 26 Sep 2008, 02:29 PM

<%

@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"

CodeFile="Default2.aspx.vb" Inherits="Default2" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<

asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

<telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True" AutoGenerateDeleteColumn="True"

AutoGenerateEditColumn="True" DataSourceID="SqlDataSource1" GridLines="None"

Skin="Inox">

<MasterTableView AutoGenerateColumns="False" DataKeyNames="UserID" DataSourceID="SqlDataSource1">

<RowIndicatorColumn>

<HeaderStyle Width="20px"></HeaderStyle>

</RowIndicatorColumn>

<ExpandCollapseColumn>

<HeaderStyle Width="20px"></HeaderStyle>

</ExpandCollapseColumn>

<Columns>

<telerik:GridBoundColumn DataField="UserID" DataType="System.Int32" HeaderText="UserID"

ReadOnly="True" SortExpression="UserID" UniqueName="UserID">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="LastName" HeaderText="LastName" SortExpression="LastName"

UniqueName="LastName">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName"

UniqueName="FirstName">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="UserName" HeaderText="UserName" SortExpression="UserName"

UniqueName="UserName">

</telerik:GridBoundColumn>

<telerik:GridDropDownColumn DataField="SecurityLevelID" DataSourceID="SqlDataSource2"

HeaderText="SecurityLevel" ListTextField="Description" ListValueField="SecurityLevelID"

UniqueName="SecurityLevelID">

</telerik:GridDropDownColumn>

</Columns>

</MasterTableView>

<FilterMenu EnableTheming="True">

<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

</FilterMenu>

</telerik:RadGrid>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NewDoesConnectionString %>"

DeleteCommand="DELETE FROM [User] WHERE [UserID] = @UserID" InsertCommand="INSERT INTO [User] ([LastName], [FirstName], [UserName], [SecurityLevelID]) VALUES (@LastName, @FirstName, @UserName, @SecurityLevelID)"

ProviderName="<%$ ConnectionStrings:NewDoesConnectionString.ProviderName %>"

SelectCommand="SELECT [UserID], [LastName], [FirstName], [UserName], [SecurityLevelID] FROM [User]"

UpdateCommand="UPDATE [User] SET [LastName] = @LastName, [FirstName] = @FirstName, [UserName] = @UserName, [SecurityLevelID] = @SecurityLevelID WHERE [UserID] = @UserID">

<DeleteParameters>

<asp:Parameter Name="UserID" Type="Int32" />

</DeleteParameters>

<InsertParameters>

<asp:Parameter Name="LastName" Type="String" />

<asp:Parameter Name="FirstName" Type="String" />

<asp:Parameter Name="UserName" Type="String" />

<asp:Parameter Name="SecurityLevelID" Type="Int32" />

</InsertParameters>

<UpdateParameters>

<asp:Parameter Name="LastName" Type="String" />

<asp:Parameter Name="FirstName" Type="String" />

<asp:Parameter Name="UserName" Type="String" />

<asp:Parameter Name="SecurityLevelID" Type="Int32" />

<asp:Parameter Name="UserID" Type="Int32" />

</UpdateParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NewDoesConnectionString %>"

SelectCommand="SELECT [SecurityLevelID], [Description] FROM [SecurityLevel]">

</asp:SqlDataSource>

</

asp:Content>

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 26 Sep 2008, 02:36 PM
Hi Dharmesh,

Please set AllowAutomaticUpdates to true.

Greetings,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Dharmesh Patel
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or