CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 11/19/2007 12:48:16 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 17 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
fuddy
Asp.Net User
MasterPage + DropDownLists + State11/19/2007 12:48:16 PM

0/0

Hi,

I have a masterpage and some contentpages which use this masterpage. On the masterpage there is a menu and two dropdownlists. The entries in the second dropdownlist depend on the selected item of the first dropdownlist. In the menu I navigate to asp-contentpages. The content depends on the items selected in both dropdownlists on the masterpage.

The problem is, that everytime I navigate to another asp-contentpage the two dropdownlists on the masterpage are set to default (unselected). How can I keep the state of the dropdownlists?

 BR,

fuddy

Rinze
Asp.Net User
Re: MasterPage + DropDownLists + State11/19/2007 2:52:35 PM

0/0

First you have to make sure the selected values are actually posted to the page you are navigating to. Then u can set the values in the dropdownlist based on the posted values.

Look at: http://www.codeproject.com/useritems/CrossPagePosting.asp for some details on cross page postback.

 

Hope this helps,

rinze


Hope this helps !
Rinze

---------
please select 'mark as answer' if this post helped you!
Adam.Kahtava
Asp.Net User
Re: MasterPage + DropDownLists + State11/19/2007 2:57:53 PM

0/0

A common "Gotcha" is reloading your Dropdownlist on every page load, which will set your DropDownList to the default on every subsequent page load.


-Adam Kahtava [http://adam.kahtava.com]
naturehermit
Asp.Net User
Re: MasterPage + DropDownLists + State11/19/2007 5:09:21 PM

0/0

You could store the property backed up in the view state

<asp:DropDownList ID="sampleDropDownList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="SampleDropDownList_SelectedIndexChanged">
   <asp:ListItem Value="1">Sample 1</asp:ListItem>
   <asp:ListItem Value="2">Sample 2</asp:ListItem>
   <asp:ListItem Value="3">Sample 3</asp:ListItem>
</asp:DropDownList><br />
 
public string OldValue {
   get {
       string _result = "1";
       object _o = ViewState["OldValue"];

       if (_o != null) {
           _result = (string)_o;
       }


       return _result;
   }

   set {
       ViewState["OldValue"] = value;
   }
}
protected void SampleDropDownList_SelectedIndexChanged(object sender, EventArgs e) {
   OldValue = sampleDropDownList.SelectedValue;
  //do something
}

Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Pro ASP. Net 3. 5 Server Controls and AJAX Components Authors: Rob Cameron, Dale Michalk, Pages: 740, Published: 2008
Beginning Object-Oriented ASP.NET 2.0 with VB.NET: From Novice to Professional Authors: Brian R. Myers, Pages: 193, Published: 2005
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional Authors: Matthew MacDonald, Pages: 954, Published: 2007
Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008
Beginning ASP.NET 3.5 in VB 9.0: From Novice to Professional Authors: Matthew MacDonald, Pages: 1149, Published: 2007
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006

Web:
MasterPage + DropDownLists + State - ASP.NET Forums I have a masterpage and some contentpages which use this masterpage. On the masterpage there is a menu and two dropdownlists. ...
MasterPage DropDownList values overwritten. - ASP.NET Forums I have a masterpage with three dropdown lists where the user selects state, city and zip code. I also have a Hyperlink with a querystring ...
ASP.NET 2.0 Master page and child pages viewstate inheritance Sep 29, 2006 ... I have a master page on which i have a TextBox, a DropDownList and a ... NET 2.0 that allows you to persist control state (aptly named ...
MasterPage and viewstate issue But MasterPage CAN take the web.config value. Also, try placing a DropDownList control inside a Panel in a Page which has view state turned on. ...
CodeProject: MasterPages reinvented - a Component Based Template ... Now, I had a little problem with a DropDownList not retaiing its state after a postback. ... Thank you for your code on the "MasterPages Reinvented". ...
aspnetinfo - Page10 - ASP.NET 2.0 Interview Questions ... How to do a language switch in the Masterpage? A41. Declare a dropdown as usual in the ...
Hannah Scott's Blog: Creating the Telereal Custom Master Page ... To use the master page select from the drop down list on Site Settings / Site Master Page Settings. Redeploying a Feature ...
ASP.NET 2.0 Tutorials : Creating Content for Master Page ASP.NET 2.0 Free Tutorials : State Management And Caching in ASp.net 2.0 .... In the Properties window, from the drop-down list, click DOCUMENT, ...
I want to access a dropdownlist control in master page in child ... I have a dropdownlist control inside a masterpage.I have created an usercontrol and ... if you load combo in postback, the dropdownlist wont save its state. ...
Access a Method in a Master Page without Code-Behind (Braintrove ... Access a Method in a Master Page with Code-Behind. Click to view Braintrove article:. Create Groups in a Drop-Down List Box. Written by Gregory Scot Collins ...




Search This Site:










how to get value of a ddl (or any other control) when using nested mastepage

master page does not exist parser error

access2000 as sitemapdatasource

onselectednodechanged handling client side (treeview 2.0)

how to create an breadcrumb without sitemapdatasource.

description metatags in content pages

changing masterpage assignment?

need help on sitemapprovider

menu not showing correctly

how can i design masterpage center aligned?.

maintain parent item hover style while in submenu

image buttons and images in menus

treeview in master.page and content.pages

how do one create a page like this in a masterpage.

master pages and viewstate

scrolling by keyboard keys in masterpages

treeview: selectednodechanged, how do i capture what i have selected ?

master page and imagebutton issue....

sitemapprovider and roles

child elements do not display with menu control

asp 2.0 cross-page posting

id selector in css; <form> tag in master page problem

hyperlink colors conflict with menu control

dynamic menu based on database table

tree view based on database query...

asp.net 2.0 treeview node custom javascript?

problem with master page.

masterpage not rendering in content page

widget/control attachments

menu and hr

  Privacy | Contact Us
All Times Are GMT