• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • Last Modified:

retain value

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
1jaws
Asked:
1jaws
  • 5
  • 4
2 Solutions
 
Bill NolanOwner, Lead Technology ProgrammerCommented:
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
 
1jawsAuthor Commented:
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
 
Bill NolanOwner, Lead Technology ProgrammerCommented:
Syntax may not be exact...

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

ComboBox.SetSelectedValue(Session["userID"]);
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
1jawsAuthor Commented:
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
 
Bill NolanOwner, Lead Technology ProgrammerCommented:
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
 
1jawsAuthor Commented:
can you be able to add that correct snytax for me to to pass the countryID after aspx?
0
 
Bill NolanOwner, Lead Technology ProgrammerCommented:
Look up "access combobox from javascript".
0
 
1jawsAuthor Commented:
I need to set the value to combobox based on coountryID... that's what I need ..
0
 
HainKurtSr. System AnalystCommented:
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
 
1jawsAuthor Commented:
Yes, that was better HainKurt.. thanks both!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now