CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 4/5/2006 6:57:17 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 25 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
angus404
Asp.Net User
Setting DropDownList value in Wizard4/5/2006 6:57:17 PM

0/0

I have a Wizard control that has 5 steps. At the end the information is stored to a database. I would like the user to be able to use the wizard to edit this information at a later time. When the user chooses to edit the information I want to populate all of the values in all of the steps, then have them go through the wizard again.

In my Page_Load event I am retrieving the database information, then trying to set the value of a DropDownList that is bound to a SqlDataSource. I try to set the value, but nothing happens. When I debug, the DropDownList is found, but there are no Items. It appears that the binding has not occured on the datasource yet.

When does the binding happen and where should I put code to set the value?

MiGovUser
Asp.Net User
Re: Setting DropDownList value in Wizard4/5/2006 7:45:14 PM

0/0

Well, a couple of things need to be clarified. First, are you "hand-loading" the DDL in the designer? If so, then the data should be there in the DDL when you go to set the value during runtime.

If you are populating during runtime, how are you doing this? There's at least two ways of doing this. How are you doing it?

Also, is the DDL within a datagrid/datalist/repeater? 

Let's tackle this first then we'll deal with the finding-the-value issue.  Smile [:)]

 


Ask one, answer one.
angus404
Asp.Net User
Re: Setting DropDownList value in Wizard4/5/2006 8:39:12 PM

0/0

The drop down list is bound to a SqlDataSource control. All of the values are set at design time. One parameter is linked to the value of a label control, which is the first thing set in the Page_Load event.

The DDL is in a Wizard step. It is not within any other controls.

After your reply I tried calling DataBind() on the DDL before I tried to set the value. This works, but I'm not sure it's the best way to do it. I did a trace on the database, and it looks like the stored procedure is not executed more than once. So, unless you have a better suggestion, I will just call the databind on each object before I try to set the value.

Thanks for your input.

MiGovUser
Asp.Net User
Re: Setting DropDownList value in Wizard4/6/2006 5:44:35 AM

0/0

Angus,

I'm not coding in ASP2.0, so I'm not familiar with Wizard control. But I did a quick read on it and I believe it operates in a "standard fashion".

So, during the initial page load, populate your DDL with - what I presume are - code values from your db (with the databind as you wrote). You need only do this once, assuming that you have set viewstate to persist for that DDL (across postbacks). I assume you have done that or the wizard automatically did it for you.

Next, take the value the user picked (i.e., the one you stored in the db) and set your DDL with that value. General syntax is:

 dropdownlist.SelectedIndex = dropdownlist.Items.IndexOf(dropdownlist.Items.FindByValue(somestringvalue)) [somestringvalue is your user's db value]

If dropdownlist.SelectedIndex <> -1 Then

Me.dropdownlist.SelectedItem.Selected = True

End If

Now, I assume that the programmer has to set the DDL to the retrieved db value. Not knowing the Wizard object, maybe it sets the DDL automatically. But then I would think you at least need to initially populate the DDL at page load with the databind (as you did and it worked).

You need only populate the DDL once (or any other asp.net form control for that matter); the values will persist across postback (if you allowed viewstate to persist for each object).  I believe as you created your Wizard it automatically sets each object to persist its viewstate.

...I'm thinking there's a wizard that stepped you thru creating the Wizard. Surprise [:O]  LOL

I hope that I helped and not confused. Good luck!


Ask one, answer one.
iloveny
Asp.Net User
Re: Setting DropDownList value in Wizard5/6/2006 4:01:15 PM

0/0

http://www.asp.net/QuickStart/aspnet/doc/profile/default.aspx

take a look at this article, i think it has what you need to do.
hope this help.


Live Happily. How?
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Beginning ASP.NET 2.0 Authors: Chris Hart, John Kauffman, Chris Ullman, David Sussman, Pages: 759, Published: 2005
Beginning Expression Web Authors: Zak Ruvalcaba, Pages: 474, Published: 2007
Programming ASP.NET: Building Web Applications and Services with ASP.NET 2.0 Authors: Jesse Liberty, Dan Hurwitz, Pages: 930, Published: 2005
Special Edition Using Microsoft Office FrontPage 2003: Special Edition Authors: Jim Cheshire, Paul Colligan, Pages: 1080, Published: 2003
C# for Programmers: Updated for C# 2.0 Authors: Paul J. Deitel, Pages: 1317, Published: 2005
Visual C# 2005: How to Program Authors: Harvey M. Deitel, Paul J. Deitel, Pages: 1591, Published: 2006
Professional SQL Server 2005 Reporting Services Authors: Paul Turley, Todd Bryant, James Counihan, Dave DuVarney, Pages: 688, Published: 2006
FrontPage 2003: The Missing Manual Authors: Jessica Mantaro, Pages: 411, Published: 2005
Pro ASP.NET for SQL Server: High Performance Data Access for Web Developers Authors: Brennan Stehling, Pages: 408, Published: 2007

Web:
Set value of DropDownList in DetailsView. All are in Master Page ... If not, I want the string "IN" set as the DropDownList Selected Value. .... Rank : Wizard. surajguptha:. just wondering if you have used javascript before? ...
Tutorial 7: Master/Detail Filtering With a DropDownList After choosing this method, the ObjectDataSource wizard prompts us for the value ... To use the value of the selected categories DropDownList item set the ...
Auto Wizard Navigation - ASP.NET Forums First of all you dont need to save dropdown selection in Session variable because wizard control hold its values till its last step. ...
Can I use an Optional Dropdown List from a table - Forums It can happens only if in main table there are values, ... the field that is set up as the lookup wizard does not show up on the list page. ...
Rendition Protocol: Set Selected DropDownList Item By Value NET DropDownList control and a value, you can set the selected item in that list if the value exists. There are a couple of ways to do this, ...
PHPRunner manual - Lookup wizard Lookup wizard - dropdown box with list of values. List of values can be ... If you set Multiline to any value greater then one this field will appear as a ...
Dynamically set the initial value of DropDownList as value from ... Dynamically set the initial value of DropDownList as value from Database .... Rank: Wizard. Velio:. you can use the dropdownlist's Items.FindByValue method: ...
DropDownList.SelectedValue = Not Working - ASP.NET I have a form (actually it is in a wizard) that needs data ... That you are trying to set the selected value of the dropdown list to ...
DropDownList value in TextBox on Page_Load event - ASP.NET Forums I used the wizard....and I can't get the load event to work with that code...the closest I get ... how or where do I set the Selected Value? ...
Tutorial 33: Master/Detail Filtering with a DropDownList Set the categoryID parameter to the value of the categories DropDownList. Upon completing the Configure Data Source wizard, Visual Studio will automatically ...




Search This Site:










create a custom login view

need help with the daab and multiple databases.

project managment module within dnn

restoring a complete site.

dotnetnuke source code on gotdotnet??

why can aspx code access files outside the virtual directory? eg. program files

does anyone have a viewstate manager?

edit command in datagrid

server only works when localhost

dynamic title & meta tags

excempting pages from forms authentication

how to catch invalid urls to a deleted portal? 3.x

thread was being aborted

output opinion

asp.net 2.0 beta web app admin help

c:\dotnetnuke\controls\address.ascx.vb(28): 'countrylistbox' is ambiguous in the namespace 'dotnetnuke.web.ui.webcontrols'.

deployment of ie web controls

can't decrypt config section use default provider (aspnet_regiis -pe)

css files are references multiple times in the head tag

html editing module

don't display full paths in the window tabs?

horizontal treeview?

timeclock module

are any events fired when an editorzone updates personalization data?

incompatibilities in .net vs php encryptions

login page vanished

programmatic impersonation, ad authentication fails under server 2003

oracle provider for dnn 3.2

database db = databasefactory.createdatabase(); throws an exception.

why can i use a server tag in a createuserwizardstep contenttemplate but not in a changepasswordtemplate?

 
All Times Are GMT