 |
BOOK: Beginning ASP.NET 4.5 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB 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
|
|
|
|
|

March 14th, 2013, 06:28 PM
|
|
Authorized User
|
|
Join Date: Aug 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Gridviews, dropdown lists, and a Sqldatasource
So I have a couple dropdown lists in a gridview which is connected to a database via a Sqldatasource. When I try to update the gridview with a selection from the ddl, it refreshes the original selections, not the new ones.
My question is this: Is there an example or section in the book that covers this? I feel like its more than a post back issue, because I've tried it with and without auto post back, among other things.
Scratching my head,
Rex
|
|

March 15th, 2013, 02:25 PM
|
|
Authorized User
|
|
Join Date: Jan 2013
Posts: 29
Thanks: 1
Thanked 1 Time in 1 Post
|
|
I ran into this issue when I was trying to make selections based on a gridview and every time it did the postback the page contents would be the same because it was overwriting my selection with the info from the database.
This is how I addressed the issue:
if (!Page.IsPostBack)
GridView1.DataBind();
|
|

March 15th, 2013, 02:33 PM
|
|
Authorized User
|
|
Join Date: Aug 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Must be something else, its still doing the same thing. Thank you for the idea though.
|
|

March 15th, 2013, 02:37 PM
|
|
Authorized User
|
|
Join Date: Jan 2013
Posts: 29
Thanks: 1
Thanked 1 Time in 1 Post
|
|
What exactly are you doing when you say you try to update the gridview with your selection?
|
|

March 15th, 2013, 02:46 PM
|
|
Authorized User
|
|
Join Date: Aug 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Well, I have two dropdown lists in a gridview, and the gridview is connected to a DB with a SQLdatasource. I have the gridview set up to update a table in the DB with a couple dropdown lists in its edit template. Clicking the edit link, then making my selections in the DDLs, I hit the update link and the gridview refreshes to its original values. No update in the database either.
I'm assuming its something I'm forgetting in my code, but I've been staring at this for so long, I'm not seeing it.
|
|

March 15th, 2013, 04:02 PM
|
|
Authorized User
|
|
Join Date: Jan 2013
Posts: 29
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Well, you could post your code for the update event. Without that it's hard to be specific.
|
|
The Following User Says Thank You to Thermopyle For This Useful Post:
|
|
|

March 18th, 2013, 10:27 AM
|
|
Authorized User
|
|
Join Date: Aug 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
As of my Friday meeting with the client, they want to do away with that particular functionality.  I'll still post it up here when I get a chance because now I'm curious. Thanks for the help and interest.
|
|
 |
|