Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 735851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:32:15+00:00 2026-05-14T07:32:15+00:00

Greetings and thank you in advance for the help. I created a user control

  • 0

Greetings and thank you in advance for the help. I created a user control in VB.NET that uses a jQuery datepicker. I am at an impasse. The code I have works for one datepicker control on the page but because I can only register the client script once, it will not work for multiple instances/datepickers on the same page. What is the best way to go about initiating the jQuery script for this control so I can use it multiple times on one page? Can I append to ClientScript.RegisterStartupScript? Thanks again.

Dim sJS As String = "$(function() { " & vbCrLf
sJS += " var dates = $('#" & txtDate1.UniqueID
sJS += "').datepicker({" & vbCrLf
sJS += " changeMonth: '" & _bMonthDropDown & "', changeYear: '" & _bMonthDropDown
sJS += "', numberOfMonths: '" & _numberOfMonths
...
sJS += "'}); });" & vbCrLf
Page.ClientScript.RegisterStartupScript(GetType(Page), "DatePicker", sJS, True)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:32:15+00:00Added an answer on May 14, 2026 at 7:32 am

    You can make just a minor change to get the behavior you want. Just change this:

    Page.ClientScript.RegisterStartupScript(GetType(Page), "DatePickerVars", sJS, True)
    

    To have something unique for a key, like this:

    Page.ClientScript.RegisterStartupScript(GetType(Page), "DatePickerVars" + txtDate1.UniqueID, sJS, True)
    

    That key (combined with the type) is what determines if this script is already registered, which you’d want for example if you had 30 of a user control and only wanted to run a certain script once. In this case though, you want each user control to register the script that’s unique to it, so give it a key that won’t be found as already being registered for this page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings! I have a Repeater control that's using an XmlDataSource control. <asp:FormView id=myFormView runat=server
Greetings, I'm working in a code base that uses alot of anonymous methods, where
Greetings: I have put together a RESTful web service in .NET 3.5 that takes
Greetings, I'm working on a game project that uses a 3D variant of hexagonal
Season's greetings! I have a function that prints out the contents of a char**
Greetings, Problem: I have a main view, that already is associated with a xib
Greetings Stackoverflow How do I set the php $_GET[] array from Jquery? I have
Greetings All, I have a SQLite database that I'm trying to add a new
Greetings everyone and thank you for checking out my post. I am trying to
Greetings Overflowers, Is there an SQL DBMS that allows me to create an indexed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.