Communicating between two custom controls

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
11/13/2006 7:28:30 AM
Gravatar
Total Posts 2

Communicating between two custom controls

Hi,

I'm currently working on a small project where I need to communicate between two custom controls placed on two different pages. CC1 sits on page one. It has a button that redirects to page two where CC2 is placed. I need to transfer data from CC1 to CC2 and I'm a little unsure how the reccomended pattern is for doing stuff like that. I've tried using url arguments, but they seem to be stripped somewhere deep in the engine room.. Anyone tried to do this?

Kind regards,

Aquaboy

11/13/2006 9:40:09 AM
Gravatar
Total Posts 18439

Re: Communicating between two custom controls

Hi,

The ASP.NET model is mostly designed for postback to the same page. It is possible to go against this model but not advisable unless you have a good reason as things get more complicated that way. In 2.0 .NET we have a PostBackUrl property that can be set on a Button to make it post back to a different page. This is one technique for passing data from a page to another page. You can see an example of cross page postback in mojoportal code in the SearchInput control which postback to SearchResults.aspx no matter which page the SearchInput control is on. So in page load of SearchResults you can see code that accesses the values passed form the previous page.

I typically only pass ids for things in querystring params and then you still have to sometimes check if the user is allowed access to the object represented by the id.

It is also perfectly alright to put some data in the db on one page and retrieve it again on the next page.

Hope it helps,

Joe
11/13/2006 10:34:36 PM
Gravatar
Total Posts 2

Re: Communicating between two custom controls

Hi Joe,

I think I'll try to be a little more elaborate regarding my problem. Communicating between a custom control and a page using the Url works perfectly. My issue is that I want to be able to communicate with a control on the receiving page.

I would like to build a small wizard where people can type in data and get a result on the last page. Now normally you would create the 4 aspx pages in the same general way that the searchresult.aspx page looks. The problem with doing it that way, is that you are not able to modify the content of the page from inside the portal (putting custom controls, web parts etc. on the page), but have to fire up VS.net to do any modifications.

So my solution to that problem is to create the pages inside the portal, putting custom controls on the pages. These custom controls needs to be able to communicate with each other. When I try to do this, it seems that the receiving custom control is not able to read the Url arguments. Somehow the HttpContext contains a request to default.aspx and not my newly created page. And the Request.Params collection doesn't contain my send arguments An obvious way would be to write data to the database between each page, but the reason I don't want to go that way is that the data gathered on each page isn't really anything that fits my model, rather it's the calculation on the last page I want to store in the database. Come to think of it, the data gathered on each page would be something that would fit very well in some sort of session store, and thrown away when the user is not around anymore.. Maybe what I'm looking for is something like the page viewstate or the session object..

Hope you get my problem..

Kind regards,

Peter

 

11/14/2006 2:44:22 AM
Gravatar
Total Posts 18439

Re: Communicating between two custom controls

I think for something like that you can postback to a single page and show and hide panels to implement a wizard, or use the new 2.0 .NET Wizard control
http://weblogs.asp.net/scottgu/archive/2006/02/21/438732.aspx

Hope it helps,

Joe
You must sign in to post in the forums. This thread is closed to new posts.