2016-06-10 12 views
0

это мой Мастер Страница Страницы ДирективаJQuery код не работает, когда нажатие кнопки в asp.net Материалов

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="DashMaster.master.cs" Inherits="TNC.DashMaster" %> 

это моя директива Page содержания

<%@ Page Title="Dashboard Page" Language="C#" MasterPageFile="~/DashMaster.Master" AutoEventWireup="true" CodeBehind="Dashboard.aspx.cs" Inherits="TNC.dash.Dashboard" %> 

в моей странице содержимого У меня есть 3 tabs {вкладка «Профиль», вкладка «Изображение», «Изменить пароль»)
, когда я обновляю информацию о своем профиле, обновляя его до файла базы данных, но после обновления я хочу показать сообщение Profile info updated Successfully.. через код за буквой b у с помощью

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"); 
     } 
    } 

я называю этот метод отображения Serveral мест

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

Возможный дубликат [Javascript оповещения перед перенаправлением в ASP.NET] (HTTP://stackoverflow.com/questions/12209822/javascript-alert-before-redirecting-in-asp-net) –

+0

@VishalSuthar: вчера его работала, но не работала сегодня ... – Sri

ответ

0

Попробуйте

ClientScript.RegisterStartupScript(typeof(Page), "key", 
      "<script type=\"text/javascript\">" + "$('.btnDashProfileSubmit').live(\"click\", function() {$('.alert-success').show(); $('.alert-success').html('Profile Update Successfully...');});" + "</script>" 
      ); 

 Смежные вопросы

  • Нет связанных вопросов^_^