473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ASP.NET 2.0 - GridView is not updating records.

Hi Everyone,
I have a very simple web app that uses .Net 2.0 login control to authenticate users and allow access to an "admin" folder. Inside that admin folder I have one page that has a SQLDataSource and a GridView control. I am using the GridView to test updating a very simple table in the database. The problem is, it will not Update the record at all! I placed this code outside of the admin folder and it worked fine. What could be causing this? My SQLDataSource and Gridview declarations are below:

Expand|Select|Wrap|Line Numbers
  1. <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"             SelectCommand="SELECT * FROM [tblCategory]" InsertCommand="INSERT INTO tblCategory(title, description) VALUES (@title, @description)" UpdateCommand="UPDATE tblCategory SET title=@title, description=@description WHERE categoryID=@categoryID">             <UpdateParameters>                 <asp:Parameter Name="title" />                 <asp:Parameter Name="description" />                 <asp:Parameter Name="categoryID" />             </UpdateParameters>             <InsertParameters>                 <asp:Parameter Name="title" />                 <asp:Parameter Name="description" />             </InsertParameters>         </asp:SqlDataSource>         <br />         &nbsp;<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"             DataKeyNames="categoryID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="Both">             <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />             <RowStyle BackColor="#EFF3FB" />             <Columns>                 <asp:BoundField DataField="categoryID" HeaderText="categoryID" ReadOnly="true" SortExpression="categoryID" />                 <asp:BoundField DataField="title" HeaderText="title" SortExpression="title" />                 <asp:BoundField DataField="description" HeaderText="description" SortExpression="description" />                 <asp:CommandField ShowEditButton="True" />             </Columns>             <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />             <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />             <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />             <EditRowStyle BackColor="#2461BF" />             <AlternatingRowStyle BackColor="White" />         </asp:GridView>
Expand|Select|Wrap|Line Numbers
  1.         <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
  2.             SelectCommand="SELECT * FROM [tblCategory]" InsertCommand="INSERT INTO tblCategory(title, description) VALUES (@title, @description)" UpdateCommand="UPDATE tblCategory SET title=@title, description=@description WHERE categoryID=@categoryID">
  3.             <UpdateParameters>
  4.                 <asp:Parameter Name="title" />
  5.                 <asp:Parameter Name="description" />
  6.                 <asp:Parameter Name="categoryID" />
  7.             </UpdateParameters>
  8.             <InsertParameters>
  9.                 <asp:Parameter Name="title" />
  10.                 <asp:Parameter Name="description" />
  11.             </InsertParameters>
  12.         </asp:SqlDataSource>
  13.         <br />
  14.  
  15.  
  16. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
  17.             DataKeyNames="categoryID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="Both">
  18.             <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  19.             <RowStyle BackColor="#EFF3FB" />
  20.             <Columns>
  21.                 <asp:BoundField DataField="categoryID" HeaderText="categoryID" ReadOnly="true" SortExpression="categoryID" />
  22.                 <asp:BoundField DataField="title" HeaderText="title" SortExpression="title" />
  23.                 <asp:BoundField DataField="description" HeaderText="description" SortExpression="description" />
  24.                 <asp:CommandField ShowEditButton="True" />
  25.             </Columns>
  26.             <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
  27.             <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
  28.             <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  29.             <EditRowStyle BackColor="#2461BF" />
  30.             <AlternatingRowStyle BackColor="White" />
  31.         </asp:GridView>
  32.  
Nov 20 '08 #1
2 1770
This problem has been resolved! Please close this question. Thanks =)
Nov 21 '08 #2
joedeene
583 512MB
Would you like to share the solution to the problem? If you want, for other users that search Google and find this thread...

joedeene
Nov 21 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: P | last post by:
Hello, I am having a difficult time updating a record via a stored procedure using the gridview and sqldatasource. I cannot seem to be able to find a way to set everything up so that I can pass...
3
by: | last post by:
Hello, I have created an ASP.NET 2.0 application that utilized a Gridview Control to display and update/delete data. The problem I am having is that the gridview control is displaying the data...
8
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my...
3
by: justin | last post by:
One of the gridviews i'm using now apparently needs to have the added functionality of re-arranging the order of the records it's representing. These records have a priority field which the dataset...
8
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to...
3
by: Polaris | last post by:
Hi Experts: I'm using asp.net 2.0 with Visual Studio 2005. I'm trying to use the GridView to display data. I need to programmatically add rows into the GridView. So far could not find a way...
11
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved,...
5
by: brian | last post by:
I have a gridview that will contain 5000 + rows that is initially loaded into a dataset and bound to a gridview. On the form I have textboxes and dropdown list's I use to let the user fill in and...
11
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.