Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
<select class="form-control" data-val="true" data-val-required="The User field is required." id="UserId" name="UserId"><option value=""></option>
<option value="6"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d392b7bebabd93a0a6b1beb6a1b0b6fdb0bcbe">[email protected]</a></option>
</select>


When I bind email in dropdownlist then email text automatically converted into [email protected].When I have tried to inspect dropdwonlist then I have got the above code snippet.

Thanks

What I have tried:

I tried to enable javascript but it's not working.
Posted
Updated 5-Nov-17 22:50pm
v2
Comments
Karthik_Mahalingam 6-Nov-17 3:29am    
how you are binding the data ?
show the code.
itsathere 6-Nov-17 3:45am    
@Html.DropDownListFor(m => Model.UserId, (Model.GetUsers == null ? Enumerable.Empty<selectlistitem>() : Model.GetUsers.Select(a => new SelectListItem { Text = a.Name, Value = a.ID.ToString() })), new { @class = "form-control" })
Karthik_Mahalingam 6-Nov-17 4:45am    
are you using the email to do something in your code?
itsathere 6-Nov-17 7:46am    
Yes. Now, I have got solution.

Thanks
Karthik_Mahalingam 6-Nov-17 7:48am    
Ok fine

Your webhost is doing this to protect against spam. Contact them to see if it can be removed or google "cloudfare email protection" for ideas to undo it.
 
Share this answer
 
Comments
itsathere 6-Nov-17 4:35am    
It's known thing, I need proper solution that's why I have posted it here.

Thanks
Just use
<!--email_off--> html code of dropdownlist here <!--/email_off-->

for more see below example:

<!--email_off--> @Html.DropDownListFor(m => Model.UserId, (Model.GetUsers == null ? Enumerable.Empty<selectlistitem>() : Model.GetUsers.Select(a => new SelectListItem { Text = a.Name, Value = a.ID.ToString() })), new { @class = "form-control" }) <!--/email_off-->


It's working fine.

Thanks
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900