SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Could anyone please tell me how to call controls on a 'multiple control webpart' dynamically by using JavaScript in sharepoint

share|improve this question

I've written an approach on my blog which deals with this. Basically you have to create a javascript class which is capable of storing the ids of each control you want to interact with. This will include an Init function that can register each of these ids.

Then, in your c# code you create and register a script block that will call that init function.

Things to be careful of: - You need to cater for your webpart being added to the page multiple times (i.e. script block registration needs to be unique and needs to create unique javascript objects). - The "id" you assign in c# will not be the one rendered on the page, as webparts have their ID generated automatically. Its been a while since I last did this but you need to set the client ID in "onprerender" i think.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.