Monday 3 December 2012

Get Client ID of Server Control in Javascript


Hi All,

Please find below simple JavaScript function to get client Id render by server control in html page via JavaScript.

          //function
function GetClientID(id, context) {
    var el = $("#" + id, context);

    if (el.length < 1)

    el = $("[id$=_" + id + "]", context);

    return el;

}
            //function call    
  var ctrlOk = GetClientID("btnOk").attr("id");

Where "btnOk" is the Id of your server control.

Thanks,
Nikhil S.

Share This!


No comments:

Post a Comment

Translate

Total Pageviews

Powered By Blogger · Designed By Seo Blogger Templates