Solved

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

Posted on 2008-09-29
3
536 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

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!

Question has a verified solution.

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

Suggested Solutions

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Using Quotation Marks in PHP This question (http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_28217211.html) seems to come up a lot for developers who are new to PHP.  And it got me thinking, "How can we explain the rule…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
This video teaches users how to migrate an existing Wordpress website to a new domain.

734 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