【发布时间】:2016-10-11 01:08:59
【问题描述】:
这是我的母版页指令
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="DashMaster.master.cs" Inherits="TNC.DashMaster" %>
这是我的内容页面指令
<%@ Page Title="Dashboard Page" Language="C#" MasterPageFile="~/DashMaster.Master" AutoEventWireup="true" CodeBehind="Dashboard.aspx.cs" Inherits="TNC.dash.Dashboard" %>
在我的内容页面中,我有 3 个标签 { 个人资料标签、图片标签、更改密码标签}
当我更新我的个人资料信息时,它会更新到数据库文件,但更新后我想通过使用后面的代码显示消息 Profile info updated Successfully..
protected void btnDashProfileSubmit_Click(object sender, EventArgs e)
{
int i = _editUserPresenter.UpdateProfile(Convert.ToInt64(txtdashuserID.Text),
txtdashusername.Text,
txtdashfirstname.Text.Trim(),
txtdashlastname.Text.Trim(),
ddlGender.SelectedValue.ToString(),
txtdashEmailID.Text,
txtdashContactNo.Text.Trim(),
txtdashdesignation.Text.Trim(),
txtdashqualification.Text.Trim());
if (i > 0)
{
//calling Display you can find this method below
Display(Convert.ToInt64(txtdashuserID.Text));
ScriptManager.RegisterStartupScript(this, GetType(), "editProfile", "$('.alert-success').show(); $('.alert-success').html('Profile Update Successfully...'); ", true);
Response.Redirect("Dashboard.aspx?userID=10000000022&username=srikanth442#divprofile");
}
else
{
ScriptManager.RegisterStartupScript(this, GetType(), "editProfileFail", "$('.alert-danger').show(); $('.alert-danger').html('Profile Update Fail. Please Try Again');", true);
Response.Redirect("Dashboard.aspx?userID=10000000022&username=srikanth442#divprofile");
}
}
我把这个显示方法叫做几个地方
public void Display(Int64 UserID)
{
DataSet ds = _userServices.GetUserByUserID(UserID);
string Username = Extension.Decrypt(ds.Tables[0].Rows[0]["username"].ToString());
Session["username"] = Username;
_userSession.LoggedIn = true;
_userSession.Username = Username;
foreach (DataRow dw in ds.Tables[0].Rows)
{
txtdashuserID.Text = dw["userid"].ToString();
txtdashusername.Text = Username;
txtdashfirstname.Text = dw["firstname"].ToString();
txtdashlastname.Text = dw["lastname"].ToString();
txtdashEmailID.Text = dw["emailid"].ToString();
txtdashContactNo.Text = dw["phone"].ToString();
txtdashdesignation.Text = dw["designation"].ToString();
txtdashqualification.Text = dw["qualification"].ToString();
if (dw["accountype"].ToString() == "1")
{
lbldashAccountType.Text = "Free";
}
if (dw["usertype"].ToString() == "1")
{
lbldashUserType.Text = "General";
}
if (dw["roles"].ToString() == "1")
{
lbldashRole.Text = "User";
}
Label lblUsername = (Label)Master.FindControl("lbldashfullname");
Label lblAccountCreatedDate = (Label)Master.FindControl("lbldashAccountCreatedon");
Label lblAccountUpdatedDate = (Label)Master.FindControl("lbldashprofileupdate");
Session["username"] = Username;
Session["AccCreateDate"] = String.Format("{0:dddd, dd MMM yyyy}", dw["account_create_date"]);
Session["AccUpdatedDate"] = String.Format("{0:dddd, dd MMM yyyy}", dw["update_account_date"]);
}
}
【问题讨论】:
-
@VishalSuthar :它昨天工作,但它今天不工作......
标签: c# asp.net c#-4.0 master-pages