Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Beginning ASP.NET 4.5 : in C# and VB
| Search | Today's Posts | Mark Forums Read
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
 
Old March 14th, 2013, 06:28 PM
Authorized User
Points: 45, Level: 1
Points: 45, Level: 1 Points: 45, Level: 1 Points: 45, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Location: Houston, TX
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via AIM to rexcampbell
Default 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
 
Old March 15th, 2013, 02:25 PM
Authorized User
Points: 118, Level: 2
Points: 118, Level: 2 Points: 118, Level: 2 Points: 118, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Posts: 29
Thanks: 1
Thanked 1 Time in 1 Post
Default

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();
 
Old March 15th, 2013, 02:33 PM
Authorized User
Points: 45, Level: 1
Points: 45, Level: 1 Points: 45, Level: 1 Points: 45, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Location: Houston, TX
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via AIM to rexcampbell
Default

Must be something else, its still doing the same thing. Thank you for the idea though.
 
Old March 15th, 2013, 02:37 PM
Authorized User
Points: 118, Level: 2
Points: 118, Level: 2 Points: 118, Level: 2 Points: 118, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Posts: 29
Thanks: 1
Thanked 1 Time in 1 Post
Default

What exactly are you doing when you say you try to update the gridview with your selection?
 
Old March 15th, 2013, 02:46 PM
Authorized User
Points: 45, Level: 1
Points: 45, Level: 1 Points: 45, Level: 1 Points: 45, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Location: Houston, TX
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via AIM to rexcampbell
Default

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.
 
Old March 15th, 2013, 04:02 PM
Authorized User
Points: 118, Level: 2
Points: 118, Level: 2 Points: 118, Level: 2 Points: 118, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Posts: 29
Thanks: 1
Thanked 1 Time in 1 Post
Default

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:
rexcampbell (March 18th, 2013)
 
Old March 18th, 2013, 10:27 AM
Authorized User
Points: 45, Level: 1
Points: 45, Level: 1 Points: 45, Level: 1 Points: 45, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Location: Houston, TX
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via AIM to rexcampbell
Default

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.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding DropDown Lists in Asp.Net venkat_vitala ASP.NET 1.0 and 1.1 Basics 1 January 17th, 2007 09:16 AM
Linked Dropdown Lists contagiouss_blue Beginning VB 6 1 June 8th, 2005 10:35 AM
dependent dropdown lists vivshah VS.NET 2002/2003 1 March 29th, 2004 05:25 PM
2 tables and 2 dropdown lists collie Classic ASP Databases 0 October 20th, 2003 07:20 AM





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