Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction (All good things must come to an end (http://en.wikipedia.org/wiki/All_Good_Things...))The original MySQL API (http://php.net/manual/en/book.mysql.php) has gone away, deprecated by PHP in Version 5.5, and removed from PHP in all current…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
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.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now