Blog Stats
  • Posts - 35
  • Articles - 0
  • Comments - 3
  • Trackbacks - 2

 

How to get the HTML name attribute of ASP.Net Control c# as.net

//Function to get the HTML name of the server control from the Client Id

// Parameters:

// clientId - Control.ClientId

// serverId - Control.id


private string GetHTMLNameById(string clientId, string serverId)

{

int pos = serverId.IndexOf('_');

string HTMLName = "";

if(pos >= 0)

{

pos = clientId.IndexOf(serverId);

HTMLName = clientId.Remove(pos, serverId.Length);

HTMLName = HTMLName.Replace('_', '$');

HTMLName += serverId;

}

else

HTMLName = clientId.Replace('_', '$');

return HTMLName;

}

Feedback

No comments posted yet.


Post a comment





 

 

 

Copyright © Sharvan Dhaka