Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
how i can get the clientid of the web image button in javascript .



Iam Using a webimagebutton in a webform which is inherited from a masterpage.The problem iam faicing is that, iam not able to acess the webimagebutton in javascript.

i think this is because the id of the control will change when it is used inside a mastre page and i have to refer the webimagbutton using its clientid.


Can any body help me in, how i can get the clientid of the web image button in javascript .



Rajesh Kamalakshan 

  • 446
    Offline posted


    var buttonClientId = '<%=igButton.ClientID;%>';


  • 28407

    HI ,

    Veiw the source code of the page, this will help you determine the clientID.

    For a webimagebutton in a master page - refer to it as



    For an webimagebutton in a contentplaceholder - refer to it as


  • 625

    ASP controls are rendered using different ID's from the one declared.

    If, for example, you have the button called 'btnTest' and that button is one a web page which has a master page, then the button is actually contained in a ContentPanel on the web page.

    To refer to it you would have to use code like :-

    var myButton = document.getElementbyId("ctl00_ContentPlaceHolder1_btnTest");

    If the button is further nested in other controls in the web page, then it can get more complex.