I am working Asp.net and c#.
In my application i have a Autocomplete textbox with literal control.I need to get the Id of that literal control in my codebehind,but i couldn't get because there is no runat attribute.If i use runat attribute my Autocomplete is not working.please give me some sugessions to solve this problem.
code:
<input ID="txtrecipient"/>
* Note :I need the id txtrecipient in codebehind.
The simplest solution is using server control with attribute runat="server" and set its ClientIDMode=Static.
If you don't want to change ClientIDMode, you can also access the client id of the textbox on client side. See below example:
<script>
document.getElementById("<%= txtrecipient.ClientID %>").value = "";
... or
$("<%= txtrecipient.ClientID %>").autoComeplete();
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.