Remembering DropDownList State When Redirecting?

Feb 16, 2011

I have DropDownList, which has some options to choose from. Now after when user selects one of the options, it has to click on a button, which is a redirection on the same page:

protected void Button4_Click(object sender, EventArgs e)
{
Response.Redirect("Graphs.aspx?Selection=" + DropDownList1.SelectedValue + "&Date1=" + TextBox1.Text + "&Date2=" + TextBox2.Text);
}

I have to use redirection instead of postback, because I use flot which is javascript library and all the code has to be written again when user selects some other option. The problem is, when it redirects back, for some reason I can't make it to remember the value in the DropDownList, which has user previously selected. I tried this with this code:

protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["Selection"] == "TemperatureOUT")
{
DropDownList1.SelectedIndex = 0;
}
else if (Request.QueryString["Selection"] == "Dewpoint")
{
DropDownList1.SelectedIndex = 1;
}
}

The problem is, if for example user selects Dewpoint from DropDownList and then clicks on a button, which causes redirection, the new url should have:

Graphs.aspx?Selection=Dewpoint&...

but instead, it says:

Graphs.aspx?Selection=TemperatureOUT&...

Now if I remove that code from Page_Load it works, but it does not remember what has user selected before. Now I know that there has to be something with Page_Load. Isn't that when page is redirected, the Page_Load get's called, so it should look a the Selection value and print it out. So it has to be a problem with redirection, that for some reason does not set the selected value.

View 2 Replies


Similar Messages:

State Management :: Redirecting To Different Application With Same URL?

Nov 4, 2010

I have two web applications and sometimes I need user to jump from one application to another. Since they are two web applications( websites) in the same machine, I can not share session between them.

The technical challenge for me is how to pass session information (I only need to pass userID string information in the session) from one source application to another destination application -- so that the user feels Single Sign On and personal information is displayed for him/her in both application (as the userID is passed to the destination application, no re-login is needed).

Another challenge is that when the user jumps to another URL in another application -- I just need to generate the common unified [URL]

View 1 Replies

State Management :: Session Value Becomes Null After Redirecting To Different Page?

Aug 4, 2010

I have logged in to the application and naviagate to Resource Editor page where it allows user to enter the value and saves to the resource file of the application.

After user clicks save button and navigate to different page the session value becomes null.

If the user navigate to different page without clicking save the session variable has its value

View 3 Replies

State Management :: Redirecting To Home Page When Session Expires?

Oct 14, 2010

my web app doesn't use authorization in web.config, but i want to detect when a session has expired and redirect to the home page.I have searched and found solutions that rely on the web app using authorization. Other solutions have implemented a user control to drop in every page.Obviosly i don't want to manually check for null on every session variable on every event of the web app, so i want the app to do it automatically.

<sessionState timeout="120"></sessionState>
<authentication mode="Forms">
<forms name="myappCookie" loginUrl="~/index.aspx" timeout="120"/>
</authentication>

doesn't work for me since i don't have allow or deny settings, since my app doesn't need authentication.

View 4 Replies

State Management :: Redirecting An Array Of Type Structure Between Web Forms?

Feb 14, 2011

J have created an array of type structure and want to redirect it in another web form.

Here is what I have:

public struct Point
{
public float lat;
public float long;
}

public Point[] GetPoint()

[Code]....

but this is not correct.

how to redirect the array in the other web form?

View 13 Replies

Web Forms :: DropDownList Not Redirecting To Page Using OnSelectedIndexChanged Event

Feb 7, 2011

I have a DropDownList that is supposed to redirect the user to a page when they change the selected index of the DropDownList. I have three parameters that are being passed by this redirecting. The first time the user changes the selectedindex, it does not work. but every time after that it works.

<asp:DropDownList ID="fiscal" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource3" DataTextField="fiscalno"
DataValueField="fiscalno" style="margin-left: 28px" Width="130px"
onselectedindexchanged="fiscal_SelectedIndexChanged" >

[Code]....

View 5 Replies

Web Forms :: Retain TextBox Values After Redirecting To Next Page And Then Redirecting Back?

Feb 2, 2014

I have a registration page I enter the details of the customers and redirect to another page for capturing photo and I come back to the registration page.  I want to retain all the values i entered when i land on the registration page.  

View 1 Replies

Web Forms :: Pass The State Name To Dropdownlist When State On Country Map Is Clicked

Mar 30, 2010

I am developing my map function. When i click the state on country map, it should return the state name. But it didn't. I've spending a lot of time google about it and try a lot of ways to solve it. But i keep getting the JS error:"null" is null or not an object. Is it because my dropdown list having this runat="server" attribute???I don't want to delete this attribute since i am using it in my code behind.

Here is piece of my code behind for the state ddl.

[Code]....

And here is piece of my html code:

[Code]....

Then, i have multiple events for the map onclick function. Here is the code:

[Code]....

View 2 Replies

State Management :: DropDownList.SelectedValue And Session State

Feb 9, 2011

I have a DropDownList on a main form that has a few values, one of which I want to store in the Session. I added the following code to the DropDownList_SelectedIndexChanged method:

Session.Add("CEEnvironment", EnvironmentDropDownList.SelectedValue);

View 4 Replies

SQL Reporting :: Remembering Rdlc Table Sorting?

Jun 14, 2010

Is there a way of getting the current column being used to sort a table on an rdlc report ?I'd like a way of remembering how the user sorted the table so they dont have to reset it every time they open the form.I know I could make them use an on screen control (eg dropdown list) to change the sorting and then capture the choice as the report is loaded.But I'd rather do it in the background I can.

View 1 Replies

Remembering Active Tab On Refresh Of ASPX Page?

Jun 4, 2010

I've got an ASPX page set up that loads and displays dynamic data from a local SQLite database. Since the data is being written to the database from a separate C# application, I've set up my ASPX page to refresh every 30 seconds when the database has flagged itself as actively receiving new data.

On my ASPX page, I've got a TabContainer with several different TabPanels that each represent a different view of the data. Now, when my page is being refreshed, the active tab panel is being reset to the one set in my ASPX page as the ActiveTabIndex.

I was wondering if there is an easy way to persist which tab is being remembered.

[Code]....

View 2 Replies

VS 2008 Text Box - Browser Remembering Password

Feb 15, 2012

How to use two textboxes as a login and password fileds so the browser will ask users if thwy want the browser to remember their credentials?

View 6 Replies

C# - Web Forms Stopped Remembering Previously Entered Values?

Nov 28, 2010

I have one question regarding browser remembering previously entered values. I'm developing ASP.NET MVC 2 application and for some reason my web site suddenly stopped remembering previously entered values in text inputs. I can still see values entered yesterday, but non from today.

I also noticed that my username textbox values started appearing in email textbox although I never changed the name or id of my html elements. The only thing I did was to remove some input elements and added some new... But they all have unique id's and names...

I did a lot of search over the web, but just couldn't find the right answer...

Would it be possible that the model binding could be causing this which I implemented today? Or maybe some web.config configuration?

View 1 Replies

Web Forms :: How To Stop The Browser From Remembering The Wrong Information

Mar 8, 2010

I have a page with some controls and a next button. When the entered information does not match the database values, an error message is displayed.

After seeing the error message, the user enters correct data and clicks next. The code behind the next button makes the error message empty and invisible and goes

to the next page. On the next page the user clicks the browser's back button. The previous page is displayed with the valid data and the error message showing.

I had expected the error message not to be displayed.

View 2 Replies

ADO.NET :: Filling State Dropdownlist According To Country From Database?

Sep 7, 2010

The 2 dropdownlist controls are-ddlCountry and ddlState. The 2 database tables are-Country and State Country table has fields named- C_ID(pk) and Country State table fields are-S_ID(pk), State, C_ID I'm able to bind the dropdownlist controls to the database. But I want the contents of ddlState to change according to the Country selected from ddlCountryI don't want to use ajax

View 9 Replies

MVC :: Showing Cities With Value's State In Html.dropdownlist?

Mar 6, 2010

i have two dropdownlis for showing State and City. when i select a state i want to show city's state.

how can i send value's state to controller and return list of city to view.

View 4 Replies

C# - Dropdownlist Selectedindexchanged Event Doesnt Change Its State?

Feb 1, 2011

In the following code everytime its taking only one item from dropdownlist. When I select any other item from dropdownlist its same as first item.

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DataSet _subcat = new DataSet();
_subcat = serviceus.Get_SERVICEUS_SUB_CATEGORYLIST(DropDownList1.SelectedValue.ToString());
lbsubcategory.DataSource = _subcat.Tables[0].DefaultView;
lbsubcategory.DataTextField = Convert.ToString(_subcat.Tables[0].Columns["CATEGORY_SUB1_NAME"].ColumnName);
lbsubcategory.DataBind();
Label5.Visible = true;
}

View 3 Replies

State Management :: Keep Data In Static Datatable And Bind Dropdownlist

Mar 25, 2011

Which one is faster? For a dropdownlist binding it the first time and using ViewSate or Turning of viewstate, keeping the data in a static datatable and binding the dropdownlist each time on a postback

View 7 Replies

State Management :: Disabling ViewState For DropDownList And Using AutoPostback With SelectedIndexChanged?

Dec 3, 2010

The sites I mantain are using way too much ViewState and I'd like to reduce that so the size of the page is reduced. I've done a lot to remedy this but I have an issue relating to DropDown lists that use AutoPostbacks.I have a dropdown list with a lot of list items and a good part of the ViewState usage is to hold the list item data. If I disable ViewState and set the AutoPostBack property to true, the page will post back and in the page load I am trying to repopulate the dropdown list with cached data. However, it seems that the SelectedIndexChanged event doesn't fire when EnableViewState="false".Is it possible to make this work without enabling ViewState for the drodown list?

View 6 Replies

Retrieve Values Related To Hierarchy Of City,country And State From Dropdownlist?

Apr 21, 2010

retrieving values related to user select a country then its automatically shows the states name of that country in next dropdownlist and after that it will automatically display the city names respected to that country.

View 6 Replies

State Management :: Strange Connection Between ViewState And DropDownList's SelectedIndexChanged Event?

Sep 20, 2010

I have this code (just for example):

[Code]....

The Code-behind file looks like that:

[Code]....

So, when i use

[Code]....

SelectedIndexChanged event doesn't fire for the first item of the DropDownList. For any other item SelectedIndexChanged fires, but not for the first one.Could someone, please, explain what kind of magic is it?(I use Visual Studio 2008)

View 2 Replies

Data Controls :: Populate Country State City Cascading DropDownList

Nov 21, 2012

is there any easy way to add city names,state names,and country names in dropdownlist..

View 1 Replies

State Management :: Cascading Dropdownlist Will Not Reload With Updated Database Data Unless End And Restart

May 19, 2010

I have a cascading dropdownlist. The first drop down is for Departments and is databound on PageLoad from the database. The user then selects a department and the second dropdown is populated with the appropriate sub departments via JQuery/JSON which calls an httphandler. The problem is as follows: I select a department and the subdepartments are filled.

I finish what I'm doing on that screen and everything is fine. But then if I go to a different screen and add an additional subdepartment then come back to original screen, the new sub department won't appear in the cascading dropdown. I have to close the browser and restart the session in order for any new sub departments to appear even though they are in the database. I put a breakpoint in the httphandler and noticed that it is only called once per session per each department in the first dropdown. I don't know why this is happening. I want it to call the httphander EVERY time the index of the department dropdown is changed.

[Code]...

View 3 Replies

Forms Data Controls :: Maintain Checkbox State On Multiple GridViews With DropDownList?

Jan 20, 2011

I have a multiView control within which I have 3 views as part of building a customer order.

Step 1: Customer is selected from gridView and Customer Name is saved in MultiView Session.

Step 2: Products are chosen from gridView. The grid is re-bound depending on which product category is selected in a dropDownList. The product details are also stored.

Step 3: All of the details required to build the INSERT query are passed to labels on a form to be reviewed before committing to db. The next stage, now that I have managed to select multiple rows, will be to display this data in another gridView.

Everything works fine, except for the paging and dropDownList which is causing the checkbox state to be lost after postBack.

I've read a few articles on this, but I think I have made the task more complicated due to the dropDownList in addition to paging. Essentially the customer will be able to select various product lines, across various bindings of the gridView so I need to persist the checkbox state and retain the data for the INSERT query.

View 13 Replies

Data Controls :: Populate Country State City Pincode Cascading DropDownList

Sep 20, 2012

Using four dropdown lists (country, state, city, pincode) in one table. i want to select one after other like based upon the country, states has to be displayed and based upon the states, cities has to be displayed and based upon the cities , pincode has to display. 

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved