i made an easy web user control by reading Scottgu articles
BUT; my user control return to me error:

CountryDropDown.ascx:
<%@ Language="C#" Inherits="System.Web.Mvc.ViewUserControl<string>" %>
<%=ViewData["countries"] = new string[] { "France", "Germany", "US", "UK" })%>
<%var q = ViewData["countries"]; %>
<%= Html.DropDownList("",ViewData["countries"] as SelectList)%>
MY VİEW : <%= Html.EditorFor(c=>c.Country,”CountryDropDown”) %>
MODEL:
public class Customer
{
[Required(ErrorMessage="NameRequired")]
[StringLength(50,ErrorMessage="Must be less than 50")]
public string Name { get; set; }
[Range(1,20,ErrorMessage="Invalid Age")]
public int Age { get; set; }
[Required(ErrorMessage="Email Required")]
[RegularExpression(@"((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}")]
public string Email { get; set; }
[UIHint("CountryDropDown")]
public string Country { get; set; }
}
how to make a ASCX in mvc with dropdownlist?
Using <%= tells ASP to print the following statement. You don’t want to be doing that in this case.
Try that.
Also, why do you assign q and not use it?