///<summary> /// Name: ResizeControl /// Writes to the console on behalf of Javascript /// Arguments: /// string id: the control's ID /// string width: the control's width /// string height: the control's height /// Returns: none ///</summary> private string JSResize(string[] args) { if (args.Length != 3) { throw new InvalidJSArgumentException("ResizeControl", -1); } //look up our component IComponent component = ((DesignContainer)host.Container).GetComponent(args[0]); System.Web.UI.WebControls.WebControl wc = component as System.Web.UI.WebControls.WebControl; if (wc == null) { throw new InvalidJSArgumentException("ResizeControl", 0); } PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(wc); PropertyDescriptor pdc_h = pdc.Find("Height", false); PropertyDescriptor pdc_w = pdc.Find("Width", false); //set the values pdc_w.SetValue(wc, pdc_w.Converter.ConvertFromInvariantString(args[1])); pdc_h.SetValue(wc, pdc_h.Converter.ConvertFromInvariantString(args[2])); System.Diagnostics.Trace.WriteLine( String.Format("Javascript requesting size change to w:{0} h:{1} for control {2}.", args[1], args[2], args[0])); return(string.Empty); }
private void MakeResponsive(System.Web.UI.WebControls.WebControl control, bool force = false, int options = 2) { if (control != null) { if (control is System.Web.UI.WebControls.Image && (options == 0 || options == 2)) { if (force) { control_LoadImage(control, EventArgs.Empty); } else { control.Load += control_LoadImage; } } if (control is System.Web.UI.WebControls.Panel && (options == 1 || options == 2)) { if (force) { control_LoadDiv(control, EventArgs.Empty); } else { control.Load += control_LoadDiv; } } foreach (var c in control.Controls.OfType <System.Web.UI.WebControls.WebControl>()) { MakeResponsive(c as System.Web.UI.WebControls.WebControl, force, options); } } }
public static void AddClass(System.Web.UI.WebControls.WebControl control, string className) { if (string.IsNullOrEmpty(control.CssClass) || control.CssClass.IndexOf(className) == -1) { control.CssClass += " " + className; } }
public static void ClickSendDisabled(System.Web.UI.Page page, System.Web.UI.WebControls.WebControl ctrl) { string clientScript = ctrl.ClientID + ".disabled='disabled';" + page.ClientScript.GetPostBackEventReference(ctrl, null) + ";"; ctrl.Attributes["onclick"] = "try{" + clientScript + " }catch(ex){alert(ex.message);} return false;"; }
public virtual void AddCssClass(System.Web.UI.WebControls.WebControl control, string className) { if (!control.CssClass.Contains(className)) { control.CssClass = control.CssClass + " " + className; } }
public static void RemoveCssClass(this System.Web.UI.WebControls.WebControl ctrl, string cssClass) { if (string.IsNullOrEmpty(ctrl.CssClass)) { return; } var list = ctrl.CssClass.Split(' '); var finalCss = string.Empty; foreach (var css in list) { if (css.Equals(cssClass, StringComparison.InvariantCultureIgnoreCase)) { continue; } if (string.IsNullOrEmpty(finalCss)) { finalCss += css; } else { finalCss += " " + css; } } ctrl.CssClass = finalCss; }
/// <summary> /// 单击控件,弹出消息的确认提示框 /// </summary> /// <param name="control">控件</param> /// <param name="message">提示消息</param> public static void ShowConfirmDialog(System.Web.UI.WebControls.WebControl control, string m) { MessageCoding mc = new MessageCoding(true); //通过代码得到消息内容 string message = mc[m]; control.Attributes.Add("onclick", "return confirm('" + message + "');"); }
private System.Web.UI.WebControls.WebControl Stylize(System.Web.UI.WebControls.WebControl c, string style, string val) { c.Style["filter"] = val; return(new System.Web.UI.WebControls.Panel() { CssClass = style, Controls = { c } }); }
/// <summary> /// 註冊控制項焦點 /// </summary> /// <param name="vForm"></param> /// <param name="vObject"></param> /// <param name="vMessage"></param> public static void RegisterClientScriptObjectFocus(System.Web.UI.Page vForm, System.Web.UI.WebControls.WebControl vObject, string vMessage) { // Set javascript alert message & Set obj focus if (vMessage != string.Empty) { PatwCommon.RegisterClientScriptAlert(vForm, vMessage); } PatwCommon.RegisterClientScriptBlock(vForm, "document.getElementById('" + vObject.ClientID + "').focus() ;"); }
public void Register(System.Web.UI.WebControls.WebControl control) { AddScriptReferencesToPage(control.Page, PreLoadScriptReferencePaths); _baseProvider.Register(control); AddScriptReferencesToPage(control.Page, ScriptReferencePaths); AddStyleReferencesToPage(control.Page); }
/// <summary> /// Removes a CSS class name from a web control. /// </summary> /// <param name="webControl">The web control.</param> /// <param name="className">Name of the class.</param> public static void RemoveCssClass(this System.Web.UI.WebControls.WebControl webControl, string className) { string match = @"\s*\b" + className + "\b"; string css = webControl.CssClass; if (Regex.IsMatch(css, match, RegexOptions.IgnoreCase)) { webControl.CssClass = Regex.Replace(css, match, "", RegexOptions.IgnoreCase); } }
/// <summary> /// Searches the specified parent control for a child control of the specified type, and throws an exception if not found. /// </summary> /// <typeparam name="T">The Type of the control to search for.</typeparam> /// <param name="pg"></param> /// <param name="parent">The parent control to search in.</param> /// <param name="childName">The ID of the child control to search for.</param> /// <returns>A <typeparamref name="System.Web.UI.WebControls.WebControl"/> of the type specified that is a child of the specified parent.</returns> public static T FindElementControl <T>(this Page pg, System.Web.UI.WebControls.WebControl parent, string childName) where T : System.Web.UI.WebControls.WebControl { T ctrl = (parent.FindControl(childName) as T); if (ctrl == null) { throw new Exception(string.Format("Unable to locate control '{0}' of type '{1}' on page.", childName, typeof(T).Name)); } else { return(ctrl); } }
public static void AddCssClass(this System.Web.UI.WebControls.WebControl ctrl, string cssClass) { if (string.IsNullOrEmpty(ctrl.CssClass)) { ctrl.CssClass = cssClass; } var list = ctrl.CssClass.Split(' '); var alreadyIn = list.Any(c => c.Equals(cssClass, StringComparison.InvariantCultureIgnoreCase)); if (!alreadyIn) { ctrl.CssClass += " " + cssClass; } }
public virtual void RemoveCssClassesStartingWith(System.Web.UI.WebControls.WebControl control, string className) { var cssClasses = control.CssClass.Split().ToList(); for (int i = 0; i < cssClasses.Count; i++) { if (cssClasses[i].StartsWith(className)) { cssClasses.RemoveAt(i); i--; } } control.CssClass = control.CssClass.Replace(className, string.Empty).Trim(); }
//用此方法请重写页面的VerifyRenderingInServerForm方法! /// <summary> /// 导出Office文件Excel或Word文件,HtmoTextWriter方式,用此方法请重写页面的VerifyRenderingInServerForm方法!Office FileType("application/ms-word")("application/ms-excel") /// </summary> /// <param name="webPage">Web.Page</param> /// <param name="webControl">Web表格控件,请重写页面的VerifyRenderingInServerForm方法!</param> /// <param name="fileType">Office FileType("application/ms-word")("application/ms-excel")</param> /// <param name="fileName">FileFullName</param> public void ExportOffice(Page webPage, System.Web.UI.WebControls.WebControl webControl, string fileType, string fileName) { webPage.Response.Clear(); webPage.Response.ClearHeaders(); webPage.Response.Buffer = false; webPage.Response.Charset = "GB2312"; webPage.Response.ContentEncoding = System.Text.Encoding.UTF8; webPage.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName, Encoding.UTF8).ToString().Replace("+", "%20")); webPage.Response.ContentType = fileType; webPage.EnableViewState = false; StringWriter tw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(tw); webControl.RenderControl(hw); webPage.Response.Write(tw.ToString()); webPage.Response.End(); }
private void SetErrorCss(List <MerchantTribe.Web.Validation.RuleViolation> violations) { // Clear Out Previous Error Classes this.cccardnumber.CssClass = ""; this.cccardholder.CssClass = ""; this.ccexpyear.CssClass = ""; this.ccexpmonth.CssClass = ""; this.ccsecuritycode.CssClass = ""; this.ccissuenumber.CssClass = ""; // Tag controls with violations with CSS class foreach (MerchantTribe.Web.Validation.RuleViolation v in violations) { System.Web.UI.WebControls.WebControl cntrl = (System.Web.UI.WebControls.WebControl) this.FindControl(v.ControlName); if ((cntrl != null)) { cntrl.CssClass = "input-validation-error"; } } }
public static void ClickSendValidDisabled(System.Web.UI.Page page, System.Web.UI.WebControls.WebControl ctrl) { string clientScript = ctrl.ClientID + ".disabled='disabled';" + page.ClientScript.GetPostBackEventReference(ctrl, null) + ";"; bool needValid = false; string validationGroup = null; if (ctrl is System.Web.UI.WebControls.IButtonControl) { System.Web.UI.WebControls.IButtonControl ibtnCtrl = ctrl as System.Web.UI.WebControls.IButtonControl; needValid = ibtnCtrl.CausesValidation; validationGroup = ibtnCtrl.ValidationGroup; } if (needValid) { clientScript = "if(Page_ClientValidate('" + validationGroup + "')){" + clientScript + "}"; } ctrl.Attributes["onclick"] = "try{" + clientScript + " }catch(ex){alert(ex.message);} return false;"; }
/// <summary> /// Abrir uma nova janela utilizando JavaScript. Necessário importar FuncoesUteis.js para seu .aspx. /// </summary> protected void SetOnClickParaAbrirNovaJanela(System.Web.UI.WebControls.WebControl controle, string pagina, StringBuilder parametros, bool paginaSegura) { // Criptogrando parametros Security.Criptografia.Criptografia criptografia = new Security.Criptografia.CriptografiaDES3(); string parametrosCriptografados = criptografia.Criptografar(parametros.ToString()); // criando string url. UrlEncode necessario como prevenção (erro de conversão). string url = string.Format("{0}?parametros={1}", pagina, Server.UrlEncode(parametrosCriptografados)); string nomePagina = "frmNovaJanela"; if (paginaSegura) { nomePagina = "frmAdministracaoJanela"; } // setando onclick para controle, abrir nova página. StringBuilder javaScript = new StringBuilder(); javaScript.AppendFormat("AbrirJanelaCentroTela('{0}', '{1}', 600, 520);", url, nomePagina); controle.Attributes.Add("onclick", javaScript.ToString()); }
public virtual void RemoveCssClass(System.Web.UI.WebControls.WebControl control, string className) { control.CssClass = control.CssClass.Replace(className, string.Empty).Trim(); }
public virtual void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer, System.Web.UI.WebControls.WebControl owner) { }
public System.Data.DataTable ChangePageTo(string currPage = "0", string perPageRowCount = "0", Dictionary <string, string> dssPostData = null, string dataTableName = "DataTableName", string dataTableNamespace = "DataTableNameSpace", Dictionary <string, string> columnKeyIDPair = null, System.Web.UI.WebControls.Table t = null) { #region when dataTable Exist columnKeyIDPair = (null == columnKeyIDPair) ? new Dictionary <string, string>() : columnKeyIDPair; this.DataTable = new System.Data.DataTable(dataTableName, dataTableNamespace); columnKeyIDPair.Select(x => this.DataTable.Columns.Add(x.Key)).ToArray(); #endregion try { string date = string.Empty; Dictionary <string, string> dss = dssPostData ?? RequestBus.GetPostData(Request: Request); AjaxResponse ar = new AjaxResponse(); #region set status ar.status = "success"; // ar.location = new Location(); // ar.location.search = "?view=1&date=" + date; #endregion Dictionary <string, AjaxResponse> dsar = new Dictionary <string, AjaxResponse>(); Dictionary <string, List <Dictionary <string, string> > > resultData = new Dictionary <string, List <Dictionary <string, string> > >(); List <Dictionary <string, string> > ldss = new List <Dictionary <string, string> >(); Boolean carryOnAfterEvent = false; #region TableInfo try { currPage = RequestBus.GetPageNum(currPage, dss: dss, currPageNumKeyName: this.Name + this.CurrPageNumKey, pageTotalCountKeyName: this.Name + this.PageTotalCountKey); perPageRowCount = "0" == perPageRowCount ? (dss.TryGetValue(this.Name + this.PerPageRowCountKey, out perPageRowCount) ? perPageRowCount : "5") : perPageRowCount; this.ResultMsgFromService = RequestPageData(dss, currPageNum: currPage, perPageRowCount: perPageRowCount); #region when dataTable Exist try { // fill table with empty data int _perPageRowCount = int.TryParse(perPageRowCount, out _perPageRowCount) ? _perPageRowCount : 5; System.Data.DataRow dr = this.DataTable.NewRow(); Object[] oAry = new Object[columnKeyIDPair.Count]; while (_perPageRowCount-- > 0) { dr = this.DataTable.NewRow(); dr.ItemArray = oAry.Clone() as Object[]; this.DataTable.Rows.InsertAt(dr, 0); } } catch (Exception exd) { } #endregion #region trigger Before PageChange event EventArgsForBeforePageChange eventArgsForBeforePageChange = new EventArgsForBeforePageChange(dss, currPageNum: currPage, perPageRowCount: perPageRowCount); if (false == OnBeforePageChange(eventArgsForBeforePageChange)) { return(this.DataTable); } else { } #endregion #region when dataTable Exist #endregion RFDataTable.ServiceResultMsg resultMsg = this.ResultMsgFromService; if (null == resultMsg) { } else if (resultMsg.DefaultSuccessRetCode != resultMsg.RetCode) { } else { #region trigger WhenPageChange event EventArgsForWhenPageChange eventArgsForWhenPageChange = new EventArgsForWhenPageChange(this.ResultMsgFromService); carryOnAfterEvent = OnPageChange(eventArgsForWhenPageChange); #endregion if (false != carryOnAfterEvent) { #region fill data to result resultData = fillResultDataToResultDict(resultMsg, currPage: currPage, perPageRowCount: perPageRowCount); /* * //ldss = RequestBus.ConvertResultMsgObjj(resultMsg.Obj); * // [{"dptid":"合计 ","zs":"1212","ROWSTAT":null},{"dptid":"6156 ","zs":"11","ROWSTAT":null},{"dptid":"1672 ","zs":"8","ROWSTAT":null}] * ldss = RequestBus.ConvertResultMsgObjj(resultMsg.Obj); * resultData[Name] = ldss; * ldss = RequestBus.ConvertResultMsgObj(resultMsg.Obj); * // [{"recordcount":"744","pagecount":"248","currentpage":"1"}] * string recordCount = "", pageCount = "", currentPage = ""; * ldss.ForEach(delegate(Dictionary<string, string> _dss) * { * _dss.TryGetValue(ServiceResultMsg.RecordCountName, out recordCount); * _dss.TryGetValue(ServiceResultMsg.PageCountName, out pageCount); * _dss.TryGetValue(ServiceResultMsg.CurrentPageName, out currentPage); * }); * currentPage = currentPage ?? currPage; * int currentPageIndex = 0; * int.TryParse(currentPage.Trim(), out currentPageIndex); * currentPageIndex = --currentPageIndex; * int rowTotalCount = 0; * int pageTotalCount = 0; * int.TryParse(recordCount.Trim(), out rowTotalCount); * pageCount = pageCount == "0" ? "1" : pageCount; * int.TryParse(pageCount.Trim(), out pageTotalCount); * resultData[InfoName] = (new List<Dictionary<string, string>> { new Dictionary<string, string> { * { RowTotalCountKey, recordCount}, * { PerPageRowCountKey, Math.Max(int.Parse(perPageRowCount),(0== pageTotalCount? 0: ((rowTotalCount)/(pageTotalCount)+(0==(rowTotalCount)%(pageTotalCount)?0:1)))).ToString() }, * { PageTotalCountKey,pageCount}, * { CurrPageIndexKey, currentPageIndex.ToString() }, * { CurrPageNumKey, currentPage}, * { RowCheckedStatusKey, "false"} * } }); * */ #endregion } else { } } } catch (Exception ex) { } #endregion ar.data = resultData; dsar["d"] = ar; ResultDataToAjaxResponse = ar; try { int _perPageRowCount = 0; List <Dictionary <string, string> > _ldss = new List <Dictionary <string, string> >(); string perPageRowCountStr = String.Empty; #region when dataTable Exist try { // get table info if (this.ResultDataToAjaxResponse.data.TryGetValue(this.InfoName, out _ldss) && null != t) { System.Web.UI.ITextControl itcCurrPageNum = null; itcCurrPageNum = (t.FindControl(t.ID + "_" + this.CurrPageNumKey) as System.Web.UI.ITextControl); string tableCurrPageNum = itcCurrPageNum.Text = (_ldss.FirstOrDefault().TryGetValue(this.CurrPageNumKey, out tableCurrPageNum) ? tableCurrPageNum : itcCurrPageNum.Text); int.TryParse((_ldss.FirstOrDefault().TryGetValue(this.PerPageRowCountKey, out perPageRowCountStr) ? perPageRowCountStr : "1"), out _perPageRowCount); string tablePageTotalCount = (t.FindControl(t.ID + "_" + this.PageTotalCountKey) as System.Web.UI.ITextControl).Text = (_ldss.FirstOrDefault().TryGetValue(this.PageTotalCountKey, out tablePageTotalCount) ? tablePageTotalCount : itcCurrPageNum.Text); string tablePerageRowCount = (t.FindControl(t.ID + "_" + this.PerPageRowCountKey) as System.Web.UI.ITextControl).Text = (_ldss.FirstOrDefault().TryGetValue(this.PerPageRowCountKey, out tablePerageRowCount) ? tablePerageRowCount : "5"); string tableRowTotalCount = (t.FindControl(t.ID + "_" + this.RowTotalCountKey) as System.Web.UI.ITextControl).Text = (_ldss.FirstOrDefault().TryGetValue(this.RowTotalCountKey, out tableRowTotalCount) ? tableRowTotalCount : "x"); #region set paging button status try { System.Web.UI.WebControls.WebControl itcPageLast = (t.FindControl(t.ID + "_" + this.PageLastKey) as System.Web.UI.WebControls.WebControl); System.Web.UI.WebControls.WebControl itcPageNext = (t.FindControl(t.ID + "_" + this.PageNextKey) as System.Web.UI.WebControls.WebControl); System.Web.UI.WebControls.WebControl itcPageFirst = (t.FindControl(t.ID + "_" + this.PageFirstKey) as System.Web.UI.WebControls.WebControl); System.Web.UI.WebControls.WebControl itcPagePrev = (t.FindControl(t.ID + "_" + this.PagePrevKey) as System.Web.UI.WebControls.WebControl); try { if (int.Parse(tablePageTotalCount) > int.Parse(itcCurrPageNum.Text ?? "0")) { itcPageLast.Enabled = true; itcPageLast.CssClass = itcPageLast.CssClass.Replace("disabled", ""); itcPageNext.Enabled = true; itcPageNext.CssClass = itcPageNext.CssClass.Replace("disabled", ""); } else { } } catch (Exception exe) { } try { if (int.Parse(itcCurrPageNum.Text ?? "0") > 1) { itcPageFirst.Enabled = true; itcPageFirst.CssClass = itcPageFirst.CssClass.Replace("disabled", ""); itcPagePrev.Enabled = true; itcPagePrev.CssClass = itcPagePrev.CssClass.Replace("disabled", ""); } else { } } catch (Exception exe) { } } catch (Exception ex) { } #endregion } else { } } catch (Exception exe) { } #endregion #region trigger After PageChange event EventArgsForAfterPageChange eventArgsForAfterPageChange = new EventArgsForAfterPageChange(this.ResultDataToAjaxResponse); carryOnAfterEvent = OnAfterPageChange(eventArgsForAfterPageChange); #endregion try { // fill the data if (this.ResultDataToAjaxResponse.data.TryGetValue(this.Name, out _ldss)) { this.DataTable.Rows.Clear(); System.Data.DataRow dr = this.DataTable.NewRow(); _ldss.ForEach(delegate(Dictionary <String, String> _dss) { dr = this.DataTable.NewRow(); dr.ItemArray = columnKeyIDPair.Select((KeyValuePair <string, string> x, int i) => { string _tmpStr = _dss.ContainsKey(x.Value) ? _dss[x.Value] : String.Empty; return(_tmpStr); }).ToArray(); this.DataTable.Rows.InsertAt(dr, 0); }); Object[] oAry = new Object[columnKeyIDPair.Count]; if (_perPageRowCount > this.DataTable.Rows.Count) { int tmpCount = _perPageRowCount - this.DataTable.Rows.Count; while (tmpCount-- > 0) { dr = this.DataTable.NewRow(); dr.ItemArray = oAry.Clone() as Object[]; this.DataTable.Rows.InsertAt(dr, 0); } } else { } } else { } } catch (Exception exf) { } } catch (Exception exd) { } if (false != carryOnAfterEvent) { Response.ClearContent(); List <Dictionary <string, string> > _ldss = new List <Dictionary <string, string> >(); if (this.ResultDataToAjaxResponse.data.TryGetValue(this.Name, out _ldss)) { columnKeyIDPair.Select((KeyValuePair <string, string> x, int i) => { RequestBus.ChangeKeyNameOfLDSS(x.Value, x.Key, _ldss); return(x.Value); }).ToArray(); } else { } Response.Write(RF.GlobalClass.Utils.Convert.ObjectToJSON(dsar)); // Response.End(); HttpContext.Current.Response.Flush(); // Sends all currently buffered output to the client. HttpContext.Current.Response.SuppressContent = true; // Gets or sets a value indicating whether to send HTTP content to the client. HttpContext.Current.ApplicationInstance.CompleteRequest(); // Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event. } else { } } catch (Exception ex) { Response.ClearContent(); AjaxResponse ar = new AjaxResponse(); Dictionary <string, AjaxResponse> dsar = new Dictionary <string, AjaxResponse>(); ar.status = "failure"; ar.message = "系统异常,请稍后再试。"; // ex.Message; dsar["d"] = ar; Response.Write(RF.GlobalClass.Utils.Convert.ObjectToJSON(dsar)); Response.End(); } return(this.DataTable); }
/// <summary> /// WebControl(UpdatePanel)中执行js脚本 /// </summary> /// <param name="webControl"></param> /// <param name="scriptText"></param> /// <param name="isAddScriptTag">是否添加ScriptTag</param> public static void RegisterAjaxJS(System.Web.UI.WebControls.WebControl webControl, string scriptText, bool isAddScriptTag) { ScriptManager.RegisterStartupScript(webControl, webControl.GetType(), "msg", scriptText, isAddScriptTag); }
protected override System.Web.UI.WebControls.WebControl CreateViewModeControlCore() { System.Web.UI.WebControls.WebControl control = new System.Web.UI.WebControls.WebControl(System.Web.UI.HtmlTextWriterTag.Div); return(control); }
/// <summary> /// 控件点击 消息确认提示框 /// </summary> /// <param name="Control">要邦定的控件</param> /// <param name="msg">提示信息</param> public static void ShowConfirm(System.Web.UI.WebControls.WebControl Control, string msg) { Control.Attributes.Add("onclick", "return confirm('" + msg + "');"); }
/// <summary> /// WebControl(UpdatePanel)中显示一消息 /// </summary> /// <param name="webControl"></param> /// <param name="msg"></param> public static void ShowAjaxMsg(System.Web.UI.WebControls.WebControl webControl, string msg) { RegisterAjaxJS(webControl, "alert(\"" + StringPlus.JSStringFormat(msg, false) + "\");", true); }
public static void AddConfirmSubmit(System.Web.UI.WebControls.WebControl objControl, String message, String eventName = "onClick") { objControl.Attributes.Add(eventName, String.Format("javascript:{0}", ScriptConfirmSubmit(message))); }
/// <summary> /// 控件点击 消息确认提示框 /// </summary> /// <param name="page">当前页面指针,一般为this</param> /// <param name="msg">提示信息</param> public static void ShowConfirm(System.Web.UI.WebControls.WebControl Control, string msg) { //Control.Attributes.Add("onClick","if (!window.confirm('"+msg+"')){return false;}"); Control.Attributes.Add("onclick", "return confirm('" + msg + "');"); }
/// <summary> /// 控件点击 消息确认提示框 /// </summary> /// <param name="Control"></param> /// <param name="msg"></param> public static void ShowConfirm(System.Web.UI.WebControls.WebControl Control, string msg) { //Control.Attributes.Add("onclick", "return confirm('" + StringPlus.JSStringFormat(msg,false) + "');"); AddJSAttrib(Control, "onclick", "return confirm('" + StringPlus.JSStringFormat(msg, false) + "');"); }
public void CopyBaseAttributes(System.Web.UI.WebControls.WebControl controlSrc) { }
/// <summary> /// 给控件添加js属性值Control.Attributes.Add("onclick", "return confirm('" + StringPlus.JSStringFormat(msg,false) + "');"); /// </summary> /// <param name="control"></param> /// <param name="attName"></param> /// <param name="scriptText"></param> public static void AddJSAttrib(System.Web.UI.WebControls.WebControl control, string attName, string scriptText) { control.Attributes.Add(attName, scriptText); }