Solved

retain value

Posted on 2011-09-14
10
312 Views
Last Modified: 2012-05-12
I have a user.aspx page that has grid and combobox, which combobox has static Please Select and dynamic items comes from datasource.. Grid gets populated based on the value selected from combobox. When row gets clicked windows opens up (windowUser.aspx) we can update that selected record, when it is updated windows closes and page goes back to user.aspx page, but it shows Please Select again.. I want it to show the value user selected, basically combobox should retain the value when return the page after updating the record from windows.aspx page.. what I need to do?
0
Comment
Question by:1jaws
  • 5
  • 4
10 Comments
 
LVL 7

Assisted Solution

by:Slimfinger
Slimfinger earned 250 total points
Comment Utility
when you say "window opens up" you are changing pages, correct?

Two solutions:

1) make your user UI a popup menu that belongs to the orginal page, and use ViewState to hold the selected user.
2) persist the selected user value elsewhere (e.g., to Session variable) and initialize the combox box on the user page as approrpriate
0
 

Author Comment

by:1jaws
Comment Utility
ok, first one wouldnt work.. I'll go with second one.. can you be more specific a little bit, perhaps little example for me to visualize..would appreacite it...
0
 
LVL 7

Expert Comment

by:Slimfinger
Comment Utility
Syntax may not be exact...

Session["userID"] = ComboBox.GetSelectedValue();

ComboBox.SetSelectedValue(Session["userID"]);
0
 

Author Comment

by:1jaws
Comment Utility
how about something like this??

passing  selected country combobox  value from user page on code behind to second page(window) and  
on javascript  when window closes pass that value back to first page again..
 winUser.NavigateUrl =xxx.aspx?id=" + dataKey["id"].ToString() + "&countryID ...

and how can I add add countryID to javascript function below after user.aspx?

 function OnClientClose(sender, eventArgs) {
                    var arg = eventArgs.get_argument();
                    if (arg) {
                        radalert("A custom argument was passed. Its value is: " + arg);
                    }
                    else {
                        window.location.href = "user.aspx";
                    }
0
 
LVL 7

Expert Comment

by:Slimfinger
Comment Utility
If you want to do it that way you have to access the combobox from jscript by its ID and get its selected value.  You have several solutions - syntax is up to you :)
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:1jaws
Comment Utility
can you be able to add that correct snytax for me to to pass the countryID after aspx?
0
 
LVL 7

Expert Comment

by:Slimfinger
Comment Utility
Look up "access combobox from javascript".
0
 

Author Comment

by:1jaws
Comment Utility
I need to set the value to combobox based on coountryID... that's what I need ..
0
 
LVL 51

Accepted Solution

by:
HainKurt earned 250 total points
Comment Utility
probably you are not using postback on popup close... use postback method, and make sure you rebind your data to your control based on posted values...
0
 

Author Closing Comment

by:1jaws
Comment Utility
Yes, that was better HainKurt.. thanks both!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now