473,767 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 AccessDataSourc e
control. Could someone help me figure it out. Here is what i have.
<asp:GridView ID="GridView1" runat="server"
AutoGenerateCol umns="False" DataKeyNames="O RDER_ID"
DataSourceID="M anagerQueue"
OnRowCommand="G ridView1_RowCom mand">
<Columns>
<asp:HyperLinkF ield DataTextField=" ORDER_ID"
HeaderText="ORD ER_ID" SortExpression= "ORDER_ID"
DataNavigateUrl Fields="ORDER_I D"
DataNavigateUrl FormatString="O rderDisplay.asp x?id={0}" />
<asp:ButtonFiel d ButtonType="But ton"
CommandName="Up dateApprove" Text="Approve Order" />
<asp:ButtonFiel d ButtonType="But ton"
CommandName="Up dateReject" Text="Reject Order" />
</Columns>
</asp:GridView>
</center>
<asp:AccessData Source ID="ManagerQueu e" runat="server" DataFile="~/
App_Data/ASPNetDB.mdb"
SelectCommand=" SELECT Order.ORDER_ID, Order.STATUS_ID FROM
[Order] WHERE Order.STATUS_ID =1;">
</asp:AccessDataS ource>
<asp:AccessData Source ID="ManagerQueu eUpdateApprove"
runat="server" DataFile="~/App_Data/ASPNetDB.mdb"
UpdateCommand=" UPDATE [Order] SET STATUS_ID = 2 WHERE ORDER_ID
= @ORDER_ID;">
</asp:AccessDataS ource>
<asp:AccessData Source ID="ManagerQueu eUpdateReject" runat="server"
DataFile="~/App_Data/ASPNetDB.mdb"
UpdateCommand=" UPDATE [Order] SET STATUS_ID = 6 WHERE ORDER_ID
= @ORDER_ID">
</asp:AccessDataS ource>

protected void GridView1_RowCo mmand(object sender,
GridViewCommand EventArgs e)
{
if (e.CommandName == "UpdateApprove" )
{
ManagerQueueUpd ateApprove.Upda te();
}
else if (e.CommandName == "UpdateReje ct")
{
ManagerQueueUpd ateReject.Updat e();
}
}


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 4086

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

Similar topics

5
2857
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 object with a GridView and a DetailsView - just for testing - and they seem to work just fine. is there something different about the way a DataList functions? Why wouldn't it trigger the same event on an update? Thanks. Jerry
1
3528
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 javascript, nothing really having to do with ASP.NET... I'm attempting to put together an application that consists of several GridView controls each bound to some xml data. Each table exists in its own update panel. The two effects I'm going for are:
0
1746
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 user. (other 3 are readonly) e.g. a column called Status is a dropdownlistbox the user can choose a status of the product and the other column called instructions is a text box, the user can type in any value.
0
1172
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 updates the same table to which gridView is bound. The subroutine for button click is as below: ------------------------------------------------- Sub fclick(ByVal o As Object, ByVal e As EventArgs) Dim con, rs, rs1, rs2, rs3, tnm,...
3
7336
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
91367
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 N-35 Mercedes if my user clicks row 2, I want to see Mercedes, How can I do that? I have a buttonClick event for my select button, I'm trying to pull the values using the DataKeyName, but I keep getting 'object reference...
0
1196
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 have to do that if customer want to update quantity he/she click on up button beside quantity textbox.here up button is html button and when it was clicked textbox quantity increased by one. e.g if 1 in textbox then it becmos 2. on up...
2
3249
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. I need the ability to insert new rows (which is easily done with DataTable.Rows.Add(newRow) and rebinding) and then present a row with different TemplateFields for those rows (I need multiple rows in this insert state).
11
4079
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
0
9575
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, 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...
0
9407
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,...
1
9960
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,...
0
9841
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 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...
1
7384
isladogs
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...
0
6656
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5280
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3534
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.