woensdag, oktober 18, 2006

 

Overriding ClientID and UniqueID on ASP.NET controls

Most of the time it is enough to add controls to the page and read out the clientid to get the correct ID, but sometimes thats undoable, well here a good 'trick' to get arround that. great tip of Rick Strahl (why didnt I come up with that? ;-) )

///
/// Override to force simple IDs all around
///

public override string UniqueID
{
get
{
return this.ID;
}
}
///
/// Override to force simple IDs all around
///

public override string ClientID
{
get
{
return this.ID;
}
}

!!! dont burn yourself read comment by Wilco Bauwer:

http://www.wilcob.com/Wilco/Default.aspx >> IDOverride