Click here to Skip to main content
15,885,921 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more: , +
hi to all,


Here i'm new for MVC. so how to set TEXTBOX\DROPDOWN and it bind from table.can you explain me briefly.and add Water mark.

DESCRIPRION:
If i want to type a starting letters and it will filer .And one more think in dropdown oly show 5 members then we will scroll for next one ok. dont show all the members in dropdown it will limited only then we will scroll for another one ok.
Posted
Updated 11-Jul-14 21:55pm
v3
Comments
jo.him1988 11-Jul-14 2:38am    
hi hope this will help you :)

1 solution

C#
@Html.TextBox("txtNane", "Enter Your WaterMark", new
{
    id = "txtId",
    onfocus = "if(document.getElementById('txtId').value=='Enter Your WaterMark')document.getElementById('txtId').value='';",
    onblur = "if(document.getElementById('txtId').value=='')document.getElementById('txtId').value='Enter Your WaterMark';"
})


if you want more statement in a function name on onfocus or onblur method of textbox like set forcolor gray etc.. you can make javascript function and call it.

for binding
@Html.TextBox('',Your Bind Object)(in above i have bind string 'Enter Your WaterMark'


dropdown for show only 5 record you have to take a dropdown under div tag and set height of div with autoscroll style
 
Bind Drop Down List with Datasource in my case i have  List<string>
<pre> @Html.DropDownListFor(s => s.myFriendList, new SelectList(Model.myFriendList))
 
Share this answer
 

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