Monday, March 26, 2012

Pass values from one user control to a user control on a different aspx page

Hello,

I have an aspx page titled Search.aspx. Within this page, I have a user control titled Search.ascx. I want a user to input search terms, then on the click of a button, I want to pass the values to another page (SearchResults.aspx)...which will then display the results in a user control.

Can someone please give me some suggestions on how to do this?

Thanks a lot!Hello, what you can do is:

inside ur usercontrol, create a method that returns a dataset or datareader. that is, since u are searching using the usercontrol, then the result of ur search will be returned by a method of type either dataset or datareader.

and in ur code-behind of the aspx page u can use it as follows:

protected Myusercontrol user;
private DataSet ds = user.GetResults();

and then u might want to put it in a session variable or xml file and then u will be able to access it from the SearchResults.aspx

but why do u want to show results in another page ?

0 comments:

Post a Comment