473,395 Members | 1,676 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,395 software developers and data experts.

Gridview buttonclick even to update row with value

I have a gridview that displays a ORDER_ID in the first column and
then I add 2 button columns on the end of it to approve or deny the
order. If they approve it I want to update the database row's column
"status" with a 2 and if they deny the order then it will update that
column to 6. Im having trouble doing that with a AccessDataSource
control. Could someone help me figure it out. Here is what i have.
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="ORDER_ID"
DataSourceID="ManagerQueue"
OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:HyperLinkField DataTextField="ORDER_ID"
HeaderText="ORDER_ID" SortExpression="ORDER_ID"
DataNavigateUrlFields="ORDER_ID"
DataNavigateUrlFormatString="OrderDisplay.aspx?id= {0}" />
<asp:ButtonField ButtonType="Button"
CommandName="UpdateApprove" Text="Approve Order" />
<asp:ButtonField ButtonType="Button"
CommandName="UpdateReject" Text="Reject Order" />
</Columns>
</asp:GridView>
</center>
<asp:AccessDataSource ID="ManagerQueue" runat="server" DataFile="~/
App_Data/ASPNetDB.mdb"
SelectCommand="SELECT Order.ORDER_ID, Order.STATUS_ID FROM
[Order] WHERE Order.STATUS_ID=1;">
</asp:AccessDataSource>
<asp:AccessDataSource ID="ManagerQueueUpdateApprove"
runat="server" DataFile="~/App_Data/ASPNetDB.mdb"
UpdateCommand="UPDATE [Order] SET STATUS_ID = 2 WHERE ORDER_ID
= @ORDER_ID;">
</asp:AccessDataSource>
<asp:AccessDataSource ID="ManagerQueueUpdateReject" runat="server"
DataFile="~/App_Data/ASPNetDB.mdb"
UpdateCommand="UPDATE [Order] SET STATUS_ID = 6 WHERE ORDER_ID
= @ORDER_ID">
</asp:AccessDataSource>

protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
if (e.CommandName == "UpdateApprove")
{
ManagerQueueUpdateApprove.Update();
}
else if (e.CommandName == "UpdateReject")
{
ManagerQueueUpdateReject.Update();
}
}


it tells me "No value given for one or more required parameters." when
it tries to do the update command with either one.

Apr 12 '07 #1
0 4079

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: | last post by:
I was trying to use a DataList control bound to a business object using an ObjectDataSource object. But the update event on the ObjectDataSource was never being triggered. I tried using the same...
1
by: jmdolinger | last post by:
Hi all, I'm a newbie to Atlas (and recently ASP.NET) after coming from a long Java background, also have done quite a bit with an Ajax.NET/ASP.NET 1.1 project, but it was basically all...
0
by: mesut | last post by:
Hi there, I've a question. I would like to create a global update button to update all changed records gridview. e.g. A gridview contains 5 columns an 2 of the columns can be updated by the...
0
by: aekta | last post by:
Hello, I am having a button control and gridview control (programmatically bind to d/b).When i click on button,fclick() sub is fired.After this the GridView disappears.The buttonclick...
3
by: pvong | last post by:
VB.NET How do you change a gridview from Update mode to normal mode? I'm usually dealing for Formviews and there is a ChangeMode option but I don't see one for Gridviews.
14
by: Mike | last post by:
I have a gridview that has a button in the last cell of each row. I want to get the text from cell 1 for that row the button was clicked on. So if my gridview looks like this: N-12 BMW ...
0
by: sejal17 | last post by:
Hello Everyone, My application is touch srceen aplication( in ASP.NET with C#). i have done here is that ,i m adding products in shopping cart with dafault product quantity one.here i...
2
by: DC | last post by:
Hi, I am using a GridView to present data in a DataTable, which I store only in ViewState and when the user hits the "OK" button the rows in the DataTable will be used to execute transactions. ...
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,...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
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,...
0
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...
0
Oralloy
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,...
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
tracyyun
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...

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.