User control multiple instances in page + common javascript functionality

Feb 8, 2011
Reaction score
I am having user control multiple instances on same page. user control is embeded with javascript functionality.

for eg.

<script type="text/javascript" language="javascript">

var Global_variable1,Global_Variable2;

function CommonFunction(){


i am calling this function from .ascx.cs like this

Me.Page.ClientScript.RegisterStartupScript(Me.GetType(), "FunctionCall","commonfunction();");

when in .aspx page (i.e in parent page ) multiple instances of the user control are loaded then it get override by 1st user control instance

i want all global variables & commonfunction() to be called for each instacne of user control
For ex. Usercontrol1,usercontrol2 are two instances in the parent page
then function should get called as Usercontol1.CommonFucntion(),Usercontrol2.commonFunction()

For global variables UserControl1.GlobalVariable1,Usercontrol2.Globalvariable1 etc

How to do this ?.please help me

Thanks & Regards,

Anirudha Deshpande


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question