Solved

Change web form parameter source from querystring to control after form loads.

Posted on 2008-09-29
3
539 Views
Last Modified: 2008-10-01
I would like to open a webform using a query string to pass parameters then allow the user to makes selections from ddls to further filter the form. There will be a gridview on the webform. How would I go about doing this? Thanks for any help.
0
Comment
Question by:AkAlan
[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
  • 2
3 Comments
 
LVL 10

Expert Comment

by:jinn_hnnl
ID: 22603394
You mean you want to select some value in that new webform gridview and return it back to the page for further step???

There are several way doing this, you can simply using javascript to set value for the opener (the page you had this new webform opened). Look at the code example.

If you opened webform is simple, I would recommend you to NOT open a new page, make it a simple div within your original page, and invisible it when inactive, open when you need to.
There are several nice ways to do it. You can take a look at ModalPopupExtender (ajax tool - free)

http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx

JINN



In your grid view, one of the button click has this event attribute (javascript)
 
function ReturnvalueToMyPage(valueSelected) {
  if (window.opener && !window.opener.closed)
    window.opener.document.myform.textbox.value = valueSelected;
  window.close();
}

Open in new window

0
 
LVL 6

Author Comment

by:AkAlan
ID: 22606318
Jinn, I think maybe I haven't made my question clear enough. I want to open a web form that has a parameterized gridview by passing in parameters using a querystring. Once the new form is open I want to be able to perform a filter of the records by allowing the user to make selections from ddls. The problem is that the datasource for the grid view is configured to accept only query string parameters and I want to know the best way to refresh the page with the new parameters that were selected from the ddls. Should I do a redirect to the same web page with a querystring created from the ddls? Is there a better way that I should look at? Thanks
0
 
LVL 10

Accepted Solution

by:
jinn_hnnl earned 500 total points
ID: 22612228
Hold on,

I guess there are more information appeared on that new web form, you have a dropdown list, and the datasource of the GridView looks at this control (or anything else to rebind its source).

The ddls has the event OnSelectedIndexChange (or something like that). This event will cause the page to post back. On serverside, you just have to get selectedValue of that ddls, rebind the Gridview datasource.

This is done programatically, so if your gridview configured by only accepting the query string let say you have:

string private m_MyQueryStringValuepublic string MyQueryStringValue(){         get {return Context.Request.QueryString("someqr"); }         set{ m_MyQueryStringValue = value; }}
Then in your selected indexChange of the ddls you just have to set one more:
MyQueryStringValue = ddls.SelectedValue;

Actually you dont even have to do it, cause you can bind directly regardless how your querystring is like.

The best way to do it (we have similar scenarios) is using UpdatePanel. It's standard component of ASP.NET. Quite simple, You might wanna put your Gridview & ddls in that UpdatePanel.

JINN
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video teaches users how to migrate an existing Wordpress website to a new domain.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

623 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