这是我的母版页页指令
<%@ 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"]);
}
}
答案 0 :(得分:0)
试试这个
ClientScript.RegisterStartupScript(typeof(Page), "key",
"<script type=\"text/javascript\">" + "$('.btnDashProfileSubmit').live(\"click\", function () {$('.alert-success').show(); $('.alert-success').html('Profile Update Successfully...');});" + "</script>"
);