Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @for(int i = 0; i < Model.Count(); ++i) {
- @Html.HiddenFor(m => m[i].Id)
- // send other properties
- }
- public ActionResult Import(HttpPostedFileBase excelfile)
- {
- //Code to get data from Excel sheet
- for( int row =2; row <=range.Rows.Count; row++)
- {
- Employeelist emp = new Employeelist();
- emp.ID =((Excel.Range)range.Cells[row,1]).Text;
- obj.Add(emp);
- }
- TempData["doc"] = obj;
- return View("success", obj);
- }
- @model IEnumerable<AzSample.Models.Employeelist>
- @using (Html.BeginForm("Save","Home", FormMethod.Post))
- {
- @Html.AntiForgeryToken()
- <h2>Employees Details</h2>
- <div>
- <table>
- <tr>
- <th>Id</th>
- </tr>
- @{var list = (List<AzSample.Models.Employeelist>)TempData["doc"];}
- @{TempData["doc"] = list;}
- @foreach (var emp in list)
- {
- <tr>
- <td>@emp.ID</td>
- </tr>
- }
- </table>
- <button type="submit" value="save" onclick="@Url.Action("Save", "Home")">Save</button>
- </div>
- }
- [HttpPost]
- public ActionResult Save()
- {
- if (TempData["doc"] != null)
- {
- // Your code will be here
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement