3

I need to create a web user control in Visual Studio that will be embedded into a .NET page within a CMS. The control will be a slideshow using jquery and the popular Nivo slider script. I have imported all the relevant scripts into my VS project.

My questions are: Is it possible to create a web user control using jquery, and where would i put my links to jquery and my code for the slideshow. Is there anyone who could give me a basic outline of how to achieve this

Thanks

R

1 Answer 1

0

you should put the slideshow script in user control if you want your control to behave independent of it's consumer and since your control will be put in a CMS then i will recommend using the slideshow scripts in UserControl Itself.

for registering the external javascript/jquery.js references you can use your control's ClientScript.RegisterStartupScript() method in the page_load event of the control and don't put it in if(!ispostback) block it should be out of it.

You can also use ClientScript.RegisterStartupScript() for resgistering your slideshow script by putting it into an function say SlideshowFunction(); then you can do like this

    protected void Page_Load(object sender, EventArgs e)
    {
      ClientScript.RegisterStartUpScript(this,this.Gettype(),"scriptid","slideshowfunction();",true);
    }

Not the answer you're looking for? Browse other questions tagged or ask your own question.