Frage

I want to use __doPostBack javascript function.

__doPostBack(obj.UniqueID,'');

But I only know ClientID of my object -

ctl00_cpholder_myObjId 
document.getElementById("ctl00_cpholder_myObjId").id //This will get ctl00_cpholder_myObjId,but UniqueID is ctl00$cpholder$myObjId

How can I get UniqueID for PostBack? Can I simply replace '_' with '$'?
Thank u.

War es hilfreich?

Lösung

If you have client id and want to get unique id from javascript, you can try

var uniqueId = document.getElementById("ctl00_cpholder_myObjId").name;

or

var uniqueId = document.getElementById("ctl00_cpholder_myObjId").getAttribute("name");

name property will return unique id.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top