首页 新闻 搜索 专区 学院

asp.net mvc ajax异步提交表单能更新,不过首次显示不出数据

0
悬赏园豆:30 [已关闭问题] 关闭于 2016-01-10 17:43

第一张图是我的简历页面首次加载效果:

第二张图是点开基本信息一栏显示的效果,数据数据库中都有,就是开始加载显示不出

第三张图是我修改数据后异步刷新的效果:

 

控制其中代码如下:

public ActionResult JianLi()
{
string LOGINID = "";
if (Session["LOGINID"] != null)
{
LOGINID = this.HttpContext.Session["LOGINID"].ToString();
}
//LOGINID = Convert.ToString(TempData["LOGINID"]); ;
/*else
{
return RedirectToAction("Login", "Account");
}*/
User user = employeemanage.FindUserInformation(LOGINID);
EmployeeModelUser u = new EmployeeModelUser();
u.ID = user.ID;
u.LOGINID = user.LOGINID;
u.NAME = user.NAME;
u.SEX = user.SEX;
u.EDUCATION_BACKGROUND = user.EDUCATION_BACKGROUND;
u.WORK_EXPERIENCE = user.WORK_EXPERIENCE;
u.PHONENUMBER = user.PHONENUMBER;
u.EMAIL = user.EMAIL;
u.SITUATIONID = new Situation()
{
ID = user.SITUATIONID.ID,
SITUATION = user.SITUATIONID.SITUATION
};
u.UPDATE_TIME = user.UPDATE_TIME;

return View(u);
}

 

public PartialViewResult GetBasicInformation()
{
string LOGINID = "";
if (Session["LOGINID"] != null)
{
LOGINID = this.HttpContext.Session["LOGINID"].ToString();
}

User user = employeemanage.FindUserInformation(LOGINID);
EmployeeModelUser u = new EmployeeModelUser();
u.ID = user.ID;
u.LOGINID = user.LOGINID;
u.NAME = user.NAME;
u.SEX = user.SEX;
u.EDUCATION_BACKGROUND = user.EDUCATION_BACKGROUND;
u.WORK_EXPERIENCE = user.WORK_EXPERIENCE;
u.PHONENUMBER = user.PHONENUMBER;
u.EMAIL = user.EMAIL;
u.SITUATIONID = new Situation()
{
ID = user.SITUATIONID.ID,
SITUATION = user.SITUATIONID.SITUATION
};
u.UPDATE_TIME = user.UPDATE_TIME;


return PartialView(u);

}

 

 

[HttpPost]
public PartialViewResult GetBasicInformation(EmployeeModelUser u)
{

string LOGINID = "";
if (Session["LOGINID"] != null)
{
LOGINID = this.HttpContext.Session["LOGINID"].ToString();
}
u.LOGINID = LOGINID;
if (ModelState.IsValid)
{
//LOGINID = Convert.ToString(TempData["LOGINID"]); ;
User user = new User();
user.LOGINID = u.LOGINID;
user.NAME = u.NAME;
user.LOGINID = u.LOGINID;
user.NAME = u.NAME;
user.PHONENUMBER = u.PHONENUMBER;
user.SEX = u.SEX;
user.SITUATIONID = new Situation()
{
ID = u.SITUATIONID.ID,
SITUATION = u.SITUATIONID.SITUATION
};
user.EMAIL = u.EMAIL;
user.EDUCATION_BACKGROUND = u.EDUCATION_BACKGROUND;
user.WORK_EXPERIENCE = u.WORK_EXPERIENCE;
user.UPDATE_TIME = u.UPDATE_TIME;
employeemanage.UpdateBasicInformation(user);
}
EmployeeModelUser u1 = new EmployeeModelUser();
User user1 = employeemanage.FindUserInformation(LOGINID);
u1.NAME = user1.NAME;
u1.LOGINID = user1.LOGINID;
u1.NAME = user1.NAME;
u1.PHONENUMBER = user1.PHONENUMBER;
u1.SEX = user1.SEX;
u1.SITUATIONID = new Situation()
{
ID = user1.SITUATIONID.ID,
SITUATION = user1.SITUATIONID.SITUATION
};
u1.EMAIL = user1.EMAIL;
u1.EDUCATION_BACKGROUND = user1.EDUCATION_BACKGROUND;
u1.WORK_EXPERIENCE = user1.WORK_EXPERIENCE;
u1.UPDATE_TIME = user1.UPDATE_TIME;

return PartialView(u1);

}

 

JianLi视图中的代码如下:

<div class="basicShow">
<!--改动-->
<%Html.Action("GetBasicInformation", new AjaxOptions { UpdateTargetId = "basicInfo" }); %>
<!--改动-->
</div>

 

<%using (Ajax.BeginForm("GetBasicInformation", "Employee", new AjaxOptions { UpdateTargetId = "basicInfo", LoadingElementId="loading", LoadingElementDuration = 3000, Url = Url.Action("GetBasicInformation"), HttpMethod = "Post" }, new { @class = "profileForm", id = "BasicInformation" }))
{ %>

洛水3000的主页 洛水3000 | 初学一级 | 园豆:14
提问于:2016-01-09 16:29
< >
分享
所有回答(1)
0

分部视图

洛水3000 | 园豆:14 (初学一级) | 2016-01-10 17:42
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册