Solved

retain value

Posted on 2011-09-14
10
314 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
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:Slimfinger
ID: 36539502
Syntax may not be exact...

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

ComboBox.SetSelectedValue(Session["userID"]);
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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:Slimfinger
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:Slimfinger
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:
HainKurt 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
asp day pilot 3 19
Printing 1 51
location of a form 2 14
The control parameters are not inputing the value when displaying in a report viewer 13 9
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

810 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