hello,
i have this helper which is textbox , instead of textbox i want dropdown list binding with my method it should be helper markup for dropdown
<div class="form-group">
@Html.LabelFor(model => model.CategoryId, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.CategoryId, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.CategoryId, "", new { @class = "text-danger" })
</div>
</div>
below is list return
public List<CategoriesBO> getallcategory()
{
List<CategoriesBO> catlist= new List<CategoriesBO>();
using (SqlConnection con = new SqlConnection(constring))
{
using (SqlCommand cmd = new SqlCommand("sp_cat", con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Action", "allcateogry");
cmd.Connection = con;
con.Open();
SqlDataReader sdr = cmd.ExecuteReader();
while (sdr.Read())
{
CatBO allcate= new CatBO {
CategoryId= int.Parse(sdr["CategoryId"].ToString()),
Name =sdr["Name"].ToString()
};
catlist.Add(allcate);
}
con.Close();
}
}
return catlist;
}