Web User Control Help

Hello all!

I’m trying to write a web user control in VS2008. I haven’t done a user control in a long time.

I need to run a simple method when the page or control loads. However, this control is for a Sitefinity site, so I’m not sure how to call the control’s method on page load (since the pages don’t really exist).

I’d like to use an init or load method within the control, but I don’t remember how. (I’ve been doing PHP lately. I haven’t done a .Net user control in over a year.)

I’m researching online, but I’m not getting a clear example. Can anyone give a quick and easy example?

Thanks!

Do your thing in the controls constructor. Use overloaded constructors if you need. Then on the page, load the control and parse them the vars needed. And have default behaviour if there is no var parsed. I hope that is wat you where looking for?

I did end up using Page Load for now. That got it working for me.

I understand what you’re saying. The trouble is that I’m using Sitefinity, which I’m not real familar with. It’s a content management system, so I’m not using code behinds on the individual pages. I just drag my control into the WYSIWYG.

That was really the issue issue I was having. I found plenty of examples online, but they were based on you having a control and a page with a code behind you’d be coding in. That’s just not the case in SF.

Thanks for replying!

Oh I see. Ok, hmmm. I do not have experience with sitefinity. So cannot help there. Strange though that you dnt have .cs page for controls.

At least it is working. lol