Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 4th, 2006, 02:48 PM
Authorized User
 
Join Date: Sep 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Gridview using Update *only*

Hello all!

I fear I may be in a little over my head, but I am trying to accomplish the following:

I have a gridview control to which I am binding data manually (using a bit of SQL & VB in a code-behind file).

Within the gridview, I have several template columns for user input, one of which is a drop-down being populated as part of the aforementioned SQL & VB code-behind.

I should also mention that the gridview is being used to display a summary of the data in question & then perform a bulk update of that data (in groups as specified by the users selection).

Because I am populating the gridview in this way, I am unable to use the canned "select" functionality of the gridview control, but I still need to use the update functionality.

Can someone please tell me how I can go about doing this?

If it is not possible to do this, then I will have a question about programmatically accessing cells within a row, but I will save that for if/when it is needed.

For more details on what is in the code-behind, look at this article: http://www.gridviewguy.com/ArticleDe...?articleID=125

I have adapted this for my own use & it is working quite well (except for the above stumbling block...).

Thanks!
 
Old December 4th, 2006, 02:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there..

if I understand correct, you are looking for a way to start the edition mode prog.???
if I'm right, you can do something like this to start the edition mode:
gridview.EditIndex = e.CommandArgument (since you need the row number to edit). You can use it inside the rowcommand function..

use
gridview.EditIndex = -1 to cancel edition.

HTH

Gonzalo
 
Old December 4th, 2006, 03:21 PM
Authorized User
 
Join Date: Sep 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thx for the response Gonzalo, & I apologize for not being clearer on what I am trying to accomplish. Let me try again:

I have attempted to circumvent the "Select" portion of the SQLDataSource control on the page by only specifying the "Update" details. However, when I do that & try to view the page, I get the message "Both DataSource and DataSourceID are defined on 'grdBulkOrderAssign'. Remove one definition." where "grdBulkOrderAssign" is the SP.

I just added a link in my original post to an article that I have adapted for use with this gridview. Within that code, I am binding to the gridview programmatically (on page_load) & the .NET framework doesn't seem to like that I am (in essence) trying to bind two separate sources to the gridview at the same time (once using a SQLDataSource control & once on page_load).

Then again, perhaps I am going about this the wrong way...

The requirements for this page are:

1) Provide a summary of the data in question, grouped by several fields.
2) Provide the user with a way to input several pieces of data on a row-by-row basis:
   - A date
   - A drop-down list (custom populated for the current row)
   - A textbox
3) Provide a button that will call a SP, passing in the data from the current row.

I used the above link, since it was the only way I could find to custom-fill the drop-down list, based on the data in the corresponding row. If there is a different technique that will give me the same results & allow for using the SQLDataSource, then I would gladly change my code to do so.

I should warn you, I am rather new to ASP.NET, so if you could provide article links, code snippets, etc. I would be very grateful.

Thanks for your help!

Phil






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with gridview update. ccarpenter ASP.NET 2.0 Basics 0 March 20th, 2008 09:18 AM
Can't get GridView to update xr280xr ASP.NET 2.0 Professional 5 February 15th, 2008 12:45 PM
using gridview control, how to update? aaronabdiel ASP.NET 2.0 Basics 2 February 13th, 2008 08:41 AM
Gridview Update Issue jpgregg ASP.NET 2.0 Professional 0 September 1st, 2006 07:35 PM
FOXPRO gridview update webclown ASP.NET 1.x and 2.0 Application Design 0 May 1st, 2006 12:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.