ms_dos

  博客园  :: 首页  :: 新随笔  ::  :: 订阅 订阅  :: 管理

//****************************************************************************************//
  /// <summary>
  /// 服务器端弹出alert对话框
  /// </summary>
  /// <param name="str_Message">提示信息,例子:"请输入您姓名!"</param>
   public void Alert(string str_Message)
  {
            ClientScriptManager scriptManager = ((Page)System.Web.HttpContext.Current.Handler).ClientScript;
            scriptManager.RegisterStartupScript(typeof(string), "", "alert('" + str_Message + "');", true);
  }

  /// <summary>
  /// 服务器端弹出confirm对话框
  /// </summary>
  /// <param name="str_Message">提示信息,例子:"您是否确认删除!"</param>
  /// <param name="btn">隐藏Botton按钮Id值,比如:btn_Flow</param>
  public void Confirm(Button btn,string str_Message)
  {
   btn.Attributes.Add("onclick","return confirm('"+str_Message+"');");
  }

  /// <summary>
  /// 服务器端移除confirm对话框
  /// </summary>
  /// <param name="btn">隐藏Botton按钮Id值,比如:btn_Flow</param>
  public void ConfirmRemove(Button btn)
  {
   btn.Attributes.Remove("onclick");
  }

  /// <summary>
  /// 客户端控件获得焦点并处于选择状态
  /// </summary>
  /// <param name="str_Ctl_Name">获得焦点控件Id值,比如:txt_Name</param>
  public void FocusSelect(string str_Ctl_Name)
  {
            ClientScriptManager scriptManager = ((Page)System.Web.HttpContext.Current.Handler).ClientScript;
            scriptManager.RegisterStartupScript(typeof(string), "", "document.getElementById('" + str_Ctl_Name + "').focus();document.getElementById('" + str_Ctl_Name + "').select();", true);
 }

/// <summary>
/// 客户端控件获得焦点
/// </summary>
/// <param name="str_Ctl_Name">获得焦点控件Id值,比如:txt_Name</param>
 public void Focus(string str_Ctl_Name)
{
      ClientScriptManager scriptManager = ((Page)System.Web.HttpContext.Current.Handler).ClientScript;
     scriptManager.RegisterStartupScript(typeof(string), "", "document.getElementById('" + str_Ctl_Name + "').focus();", true);
 }       
        
  //****************************************************************************************//

posted on 2007-07-25 14:59  ms_dos  阅读(344)  评论(0编辑  收藏  举报