Solved

retain value

Posted on 2011-09-14
10
319 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 7

Assisted Solution

by:Bill Nolan
Bill Nolan earned 250 total points
ID: 36538904
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
ID: 36538955
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:Bill Nolan
ID: 36539502
Syntax may not be exact...

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

ComboBox.SetSelectedValue(Session["userID"]);
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:1jaws
ID: 36539559
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:Bill Nolan
ID: 36539628
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
 

Author Comment

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

Expert Comment

by:Bill Nolan
ID: 36539907
Look up "access combobox from javascript".
0
 

Author Comment

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

Accepted Solution

by:
Huseyin KAHRAMAN earned 250 total points
ID: 36540334
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
ID: 36540420
Yes, that was better HainKurt.. thanks both!!
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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