ASP.NET how to remove Placeholder data in form field name?
I want to access my post values and for many reasons I can't use any alternative measures ATM, is there a way to remove the "ct$100PlaceHold开发者_运维百科ermyFieldName" from my field values?
This is possible to do in the latest version of ASP .NET 4; however, generally, you can always get the client-generated ID without any problems:
For example, in javascript you can simply do this:
var myElement = document.getElementById('<%=fieldName.ClientID%>');
And when it's rendered on the page it will translate to:
var myElement = document.getElementById('ct_100PlaceHoldermyFieldName');
On the server-side, you also have at hand properties such as UniqueID, ClientID and Id. You should be able to address any issues you have regardless of whether the field is placed inside another container or not.
精彩评论