Hello,
I am trying to use the radGrid to do something simple at first as I learn more about it.
I have the grid inside a div and I have linked the grid to an OpenAccessLinqDataSource.
I manually added a record in the underlying table to get it to show inside the grid.
That part worked and it shows. I enabled the AllowAutomaticInserts, Updates, and Deletes
options. When I click the Edit button in the grid, it shows the update screen but when
I change any data then click Update, the grid reverts back to old values and nothing
is changed in the database. The same goes for Delete, nothing happens.
I am sure I am doing something wrong because of ignorance at this point.
Here is a code listing of how I have the radgrid setup.
Also here is a create script of the underlying table.
I am trying to use the radGrid to do something simple at first as I learn more about it.
I have the grid inside a div and I have linked the grid to an OpenAccessLinqDataSource.
I manually added a record in the underlying table to get it to show inside the grid.
That part worked and it shows. I enabled the AllowAutomaticInserts, Updates, and Deletes
options. When I click the Edit button in the grid, it shows the update screen but when
I change any data then click Update, the grid reverts back to old values and nothing
is changed in the database. The same goes for Delete, nothing happens.
I am sure I am doing something wrong because of ignorance at this point.
Here is a code listing of how I have the radgrid setup.
<div class="WebpageManagementBox"> <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowSorting="True" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" DataSourceID="OpenAccessLinqDataSource1" GroupPanelPosition="Top" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"> <ClientSettings> <Scrolling AllowScroll="True" UseStaticHeaders="True" /> <Selecting AllowRowSelect="true" /> </ClientSettings> <MasterTableView DataSourceID="OpenAccessLinqDataSource1" AutoGenerateColumns="false"> <Columns> <telerik:GridBoundColumn DataField="Webpage_name" ItemStyle-Width="100px" FilterControlAltText="Filter Webpage_name column" HeaderText="Webpage_name" ReadOnly="True" SortExpression="Webpage_name" UniqueName="Webpage_name"> <ColumnValidationSettings> <ModelErrorMessage Text="" /> </ColumnValidationSettings> </telerik:GridBoundColumn> <telerik:GridCheckBoxColumn DataField="Add_privledge" DataType="System.Boolean" FilterControlAltText="Filter Add_privledge column" HeaderText="Add_privledge" ReadOnly="False" SortExpression="Add_privledge" UniqueName="Add_privledge"> </telerik:GridCheckBoxColumn> <telerik:GridCheckBoxColumn DataField="Edit_privledge" DataType="System.Boolean" FilterControlAltText="Filter Edit_privledge column" HeaderText="Edit_privledge" ReadOnly="False" SortExpression="Edit_privledge" UniqueName="Edit_privledge"> </telerik:GridCheckBoxColumn> <telerik:GridCheckBoxColumn DataField="Delete_privledge" DataType="System.Boolean" FilterControlAltText="Filter Delete_privledge column" HeaderText="Delete_privledge" ReadOnly="False" SortExpression="Delete_privledge" UniqueName="Delete_privledge"> </telerik:GridCheckBoxColumn> <telerik:GridCheckBoxColumn DataField="View_privledge" DataType="System.Boolean" FilterControlAltText="Filter View_privledge column" HeaderText="View_privledge" ReadOnly="False" SortExpression="View_privledge" UniqueName="View_privledge"> </telerik:GridCheckBoxColumn> </Columns> </MasterTableView> </telerik:RadGrid> </div> <telerik:OpenAccessLinqDataSource ID="OpenAccessLinqDataSource1" runat="server" ContextTypeName="GATEModel.EntitiesModel" EntityTypeName="" ResourceSetName="Security_Role_To_Webpages" Select="new (Add_privledge, Delete_privledge, Edit_privledge, Security_role_id, View_privledge, Webpage_name)"> </telerik:OpenAccessLinqDataSource>Also here is a create script of the underlying table.
USE [GATE]GO/****** Object: Table [dbo].[Security_Role_To_Webpage] Script Date: 2/6/2015 7:51:36 AM ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[Security_Role_To_Webpage]( [ID] [int] IDENTITY(1,1) NOT NULL, [webpage_name] [varchar](200) NULL, [security_role_id] [int] NULL, [add_privledge] [bit] NULL, [edit_privledge] [bit] NULL, [delete_privledge] [bit] NULL, [view_privledge] [bit] NULL, CONSTRAINT [PK_security_role_to_webpage] PRIMARY KEY CLUSTERED ( [ID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GOSET ANSI_PADDING OFFGOALTER TABLE [dbo].[Security_Role_To_Webpage] ADD CONSTRAINT [DF_Security_Role_To_Webpage_add_privledge] DEFAULT ((0)) FOR [add_privledge]GOALTER TABLE [dbo].[Security_Role_To_Webpage] ADD CONSTRAINT [DF_Security_Role_To_Webpage_edit_privledge] DEFAULT ((0)) FOR [edit_privledge]GOALTER TABLE [dbo].[Security_Role_To_Webpage] ADD CONSTRAINT [DF_Security_Role_To_Webpage_delete_privledge] DEFAULT ((0)) FOR [delete_privledge]GOALTER TABLE [dbo].[Security_Role_To_Webpage] ADD CONSTRAINT [DF_Security_Role_To_Webpage_view_privledge] DEFAULT ((0)) FOR [view_privledge]GOALTER TABLE [dbo].[Security_Role_To_Webpage] WITH CHECK ADD CONSTRAINT [FK__security___secur__60A75C0F] FOREIGN KEY([security_role_id])REFERENCES [dbo].[Security_Role] ([ID])GOALTER TABLE [dbo].[Security_Role_To_Webpage] CHECK CONSTRAINT [FK__security___secur__60A75C0F]GO