Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

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
add comment

Your Answer

 
discard

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