开发者

How to update bulk users at one time...using asp.net mvc

开发者 https://www.devze.com 2022-12-30 23:22 出处:网络
I have to update the users based on input value.. here is my code.. <fieldset> <legend>StudnetInfo</legend>

I have to update the users based on input value..

here is my code..

<fieldset>
<legend>StudnetInfo</legend>

here i have two textboxes and two dropdown list boxes.. this is the fiedlset user is going to enter their information.. 
</fieldset>

on the same page i have couple of other Fieldset with there studentInfo with twotextboxes and two dropdownlistboxes smililarly above Fieldset..this data dynamically generated from database for each users.

so all here my intension is insted of updating each and every Fieldset i made one generic fieldset to update all other Fieldsets information

on the Generic view I have this BeginForm

<% using (Html.BeginForm("Update", "home", FormMethod.Post,
    new { @id="studentid"})) 
   { %>

my JsonResult is

 public JsonResult Update(StudentBE e)
        {

        try
        {
            var UStatus = Generic.UpdateStudent(e.student,"","");

            return Json(UStatus.ToString());
        }
        catch (Exception ex)
        {
            return Json(ex.ToString());
        }
        finally
        {
        }
    }

using this I can update only one user perfectly but I need to loo update all users based on generic Filedset values?

can 开发者_运维问答anybody advice me about this? how to do this?

Thanks


You need to create one model with all of the data you want to modify, then push all of the content back to the server, not just a single student. Rather than passing the student ID as a routing parameter, you need to store each student key in something else like a hidden field.

And, when you return JSON, you need to return the entire model as JSON, not a single record. Alternatively, if you are using JQuery or MS AJAX to async communicate with the server, you can setup each student as a separate form, and send the data async.

HTH.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号