0

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

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.