Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-09-29
3
Medium Priority
?
542 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
  • 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 1500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
Suggested Courses

916 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