Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Multiple calls to a module controller method on the same page load :(Multiple calls to a module controller method on the same page load :(
Previous
 
Next
New Post
2/12/2007 12:41 PM
 
Hi,

I am developing some new modules that fetch data from a remote server using SOAP. I have successfully created the controller, the webcontrol and installed it as a module, added it to a page and got the correct results.

But just now I found out that actually the SOAP method is called 3 or 4 times for each page load!

I have a FormView1 object in webcontrol ViewOrderDetails.ascx which has an ObjectDataSource. And I believe this ObjectDataSource is calling the controller multiple times probably because the Page_Load event is happening multiple times.

I have no clue on why this is happening. Can anyone help me?

Thanks in advance,
Nuno
 
New Post
2/12/2007 2:17 PM
 

It is not unusual, especially if in a Postback situation, that a usercontrol is loaded more than once.

Debug, add a breakpoint to the Page_Load method and review the Stack Trace for where the control is being instantiated.

If this is something you cannot work around - and you wish to save multiple SOAP method calls, then use some form of caching logic in the controller so the call is only made once, and is just fetched from memory during future Page_Loads.


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
2/12/2007 7:10 PM
 
Hi cnurse,

Thank you. Now at least I know it is normal for a module to get called multiple times.
But unfortunately the call stack seems to be exactly the same for all the times.

There is only one funny thing I notice:

the 1st time it hits the breakpoint the page is still not refreshed;
the 2nd time it displays the DNN administration top bar (where you can add modules and such)
the 3rd time it displays the skin header
the 4th time it displays the left menu and all the pane skeleton
the 5th time finally displays the output of the SOAP call on the content pane

all these times the SOAP call was made!

Another thing: I just have an ObjectDataSource and a FormView and right now all data binding is automatic. Can this be the reason? Should I do it manually?

Thanks,
Nuno
 
New Post
2/13/2007 3:59 AM
 

If I remember correctly, there is a bug in the FormView control which causes this kind of behavior (I don't remember the details sorry...).

Try googling a bit on the subject of FormView postback bugs.

 


Thanks,
Vladan Strigo
NETMedia

My website: Vladan.Strigo.NET

Vladan.Strigo.NET: Projects
* Advanced VS2005 development approach - BlankModule
* DNN & Microsoft Ajax best practices guidance

Vladan.Strigo.NET: Resources
* Comprehensive list of DNN 4 Module development resources

 
New Post
2/13/2007 7:48 AM
 
Hi cnurse,
Thank you for your information. Instead of adding caching logic in the controller I configured ObjectDataSource to cache results. It worked fine. I hope this solves it. Actualy I tried to add cache at the controller level but I soon found out that then I'd have to pass it the cache object which would make things unnecessarily more complex. I'll do it if I need a better cache control in specific situations.

Hi Vladan,
Thank you, but I believe this problem is not specific to FormView. It is happening in all my custom modules and most of them use a GridView instead.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Multiple calls to a module controller method on the same page load :(Multiple calls to a module controller method on the same page load :(


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out