p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   Editing Updating Sorting an Unbound Gridview (http://p2p.wrox.com/showthread.php?t=39814)

Robby March 14th, 2006 02:25 PM

Editing Updating Sorting an Unbound Gridview
 
I've got a Gridview on an ASP.net page. I can't bind it because there are also unbound controls on the page (and binding them messes up the connection).

All I want to do is enable the neat editing,sorting and updating functionally.

It seems possible but the only code I've seen that comes close is in C# and I can't convert it.

I understand that there are a few lines that need to go into the RowUpdating Sub, RowEditing Sub etc but I can't actually get it working.

Any Ideas?

Thanks


jbenson001 March 15th, 2006 02:54 PM

What is the datasource for the GridView?

Jim


Robby March 17th, 2006 10:07 AM

The Datasource is a SelectCommand from a SQL database. I tried using the built in databinding, but the other SQL commands in my code (Some quite complex) then get messed up because of the bound data.

Ideally I'd like to be able to have some bound and some unbound (at design time) controls on the on the page, but it doesn't seem to work.

Any ideas on how I could get this to work?


jbenson001 March 17th, 2006 10:57 AM

There is no reason why you cannot have both bound and unbound columns in your datagrid. What do you mean "it doesn't seem to work"?


Robby March 22nd, 2006 07:20 AM

I started off with the difficult bits, these are things like queries that were doing calculations/lookups on the fly etc.

It all worked great.

I then got to the easier part, where I dragged a SQL datasource, dataset etc onto the form and bound it too some text/list boxes.

However, as soon as I ran it, the site wouldn't even go past the first page (the SQL datasurce control was on the 4th page)! I then removed the binding and found the site still didn't work! I located the problem to being a copy of the SQL database having been created. Once the copy was removed, the site ran fine.

I did this twice just to make sure, and it happened both times.

I really don't know what caused the problem, it was weird.

Do the standard data controls automatically create a backup of the data? Do the standard data controls open a connection as soon as the site starts? I always close the DB connection as soon as I've run a query so I think any connection conflicts must have been caused by the standard controls.




jbenson001 March 22nd, 2006 10:41 AM

Create backup of data? The sqldatasoure's connection opens and closes automatically when the page runs and the control is bound.



All times are GMT -4. The time now is 02:02 AM.

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