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: - <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 /> <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>
- <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 />
-
-
-
<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>
-
2 1793
This problem has been resolved! Please close this question. Thanks =)
Would you like to share the solution to the problem? If you want, for other users that search Google and find this thread...
joedeene
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 the applicable fields in the gridview to a
sqldatasource which in turn calls a sproc with the appropriate parameters and
data. Any ideas?
Thanks in advance,
|
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
correctly but it is not updating or deleting the rows. What I did was, in
design view, added a gridview control and added an sqldatasource control. I
configured the data source to update and delete. In the gridview tasks I
selected enable...
|
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 select, remember it, and
then use it in the update. It works just fine when I have full control of the
whole process.
I want to do the same for my GridView/SqlDataSource combinations. I
typically select from a view and update the corresponding...
|
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
gets sorted on and I thought the quickest way to do this would be to
add "move up", "move down" buttons next to the grid which would shuffle
the rows up and down by swapping their priority field values and
updating.
At least that seemed to be...
|
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 display data in a "GridView"
which is tied to an "ObjectDataSource".
In turn, this ObjectDatasource gets it's data from a strongly-typed
business object within my code.
| |
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 to do it. I appreciate it if any one
can show a piece of code doing that.
|
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, CrtdUser and Date
And Edit and Delete buttons
|
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 click
an add button to add new records.
As I let users add records I update the SQL backend (insert a record). I want to
programattically add a row to the gridview an not having to requery the
table reload the dataset and bind each time a...
|
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 if that's what's causing the
behavior or not. It seems like the Update button should at least do
something.
When the Edit button is clicked, the grid goes into Edit mode and the Cancel
button takes the grid out of Edit mode. So, I don't get what...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |