User control multiple instances in page + common javascript functionality

Discussion in '.NET' started by Anirudha24.d, Feb 8, 2011.

  1. Anirudha24.d

    Anirudha24.d

    Joined:
    Feb 8, 2011
    Messages:
    3
    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(){
    }

    </script>

    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
    Anirudha24.d, Feb 8, 2011
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Allan Ebdrup
    Replies:
    3
    Views:
    1,012
    Allan Ebdrup
    Jan 13, 2006
  2. Denny
    Replies:
    1
    Views:
    752
    spamtrap2@mail.ru
    May 1, 2008
  3. Phobos

    Creating multiple instances of a Web User Control.

    Phobos, Aug 16, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    165
    Phobos
    Aug 16, 2004
  4. John Reye
    Replies:
    28
    Views:
    1,327
    Tim Rentsch
    May 8, 2012
  5. Jason Mellone
    Replies:
    3
    Views:
    69
    Jurko Gospodnetić
    May 7, 2014
Loading...

Share This Page