Click here to Skip to main content
16,007,443 members

Comments by Member 11794209 (Top 10 by date)

Member 11794209 17-Jul-15 10:39am View    
@model IEnumerable<mvcapplication3.models.loginmodel>

[httppost]
public actionresult update(formcollection form){
not getting the table values here how can i pass table values
}
Member 11794209 17-Jul-15 9:44am View    
I am binding the values to the table using foreach condition after edit i want to pass values from table to controller how can i pass please help me

@model IEnumerable<mvc5_sessions.models.product>

@{
ViewBag.Title = "Index";
}

Index



<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.ProductId)
</th>
<th>
@Html.DisplayNameFor(model => model.ProductName)
</th>
<th>
@Html.DisplayNameFor(model => model.UnitPrice)
</th>
<th>
@Html.DisplayNameFor(model => model.Category.CategoryName)
</th>
<th></th>
</tr>

@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.ProductId)
</td>
<td>
@Html.DisplayFor(modelItem => item.ProductName)
</td>
<td>
@Html.DisplayFor(modelItem => item.UnitPrice)
</td>
<td>
@Html.DisplayFor(modelItem => item.Category.CategoryName)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ProductId }) |
@Html.ActionLink("Details", "Details", new { id=item.ProductId }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ProductId })
</td>
</tr>
}

</table>
Member 11794209 17-Jul-15 1:28am View    
i want to save both id and text in the same table how can i do it
Member 11794209 16-Jul-15 10:26am View    
while saving i want to save the dropdown text in db and i want to bind that text in another view page in form loading [httpget]method
Member 11794209 16-Jul-15 10:02am View    
@model MvcApplication2.Models.EmployeeDetails

@using (Html.BeginForm()) {
@Html.LabelFor(m => m.name)
@Html.TextBoxFor(m => m.name)

@Html.DropDownList("istateid", (SelectList)ViewBag.stateList, "--Choose Your State--")
@Html.DropDownList("icityid", (IEnumerable<SelectListItem>)ViewBag.cityList, "--Choose Your City--")
@Html.DropDownList("iareaid", (IEnumerable<SelectListItem>)ViewBag.areaList, "--Choose Your Area--")

<input type="submit" value="submit" />

}

IN CONTROLLER
[HttpPost]
public ActionResult postyourad(EmployeeDetails value)
{
we can get the normal textbox value directly and dropdown value will bind and i need to bind the dropdown text
}