private void imgEnum_DataBinding(object sender, EventArgs e) { Image imgEnum = (Image)sender; GridViewRow container = (GridViewRow)imgEnum.NamingContainer; imgEnum.ImageUrl = HttpUtility.HtmlEncode(WebControlHelper.GetWebResourceUrl(imgEnum.Page, this.GetType(), CarrotBooleanImageItemTemplate.IconResourcePaperclip)); try { string sValue = DataBinder.Eval(container, "DataItem." + _field).ToString(); CarrotImageColumnData img = (from i in _images where i.KeyValue.ToLowerInvariant() == sValue.ToLowerInvariant() select i).FirstOrDefault(); if (img != null) { imgEnum.ImageUrl = img.ImagePath; imgEnum.AlternateText = img.ImageAltText; } else { imgEnum.AlternateText = "[" + _field + "] IMAGE DEF MISSING"; } imgEnum.ToolTip = imgEnum.AlternateText; } catch { imgEnum.AlternateText = _field; imgEnum.ToolTip = _field; } }
protected override void RenderContents(HtmlTextWriter output) { int ident = output.Indent; string sJSFile = WebControlHelper.GetWebResourceUrl(this.GetType(), "Carrotware.Web.UI.Controls.jsHelperLibrary.js"); string sJQFile = WebControlHelper.GetWebResourceUrl(this.GetType(), "Carrotware.Web.UI.Controls.jquery-1-8-3.js"); output.Indent = ident + 3; output.WriteLine(); output.WriteLine("<!-- Javascript Helper Functions BEGIN -->"); output.WriteLine("<script src=\"" + sJSFile + "\" type=\"text/javascript\"></script> "); if (LoadJQueryAsServerControl) { this.Page.Header.Controls.AddAt(0, new jquery()); } else { output.WriteLine("<script type=\"text/javascript\">__carrotware_SetJQueryURL('" + sJQFile + "');</script> "); } output.WriteLine("<!-- Javascript Helper Functions END -->"); output.WriteLine(); output.Indent = ident; }
private void DoHelper(HttpContext context) { context.Response.Cache.VaryByParams["ts"] = true; DoCacheMagic(context, 10); string sBody = WebControlHelper.GetManifestResourceStream("Carrotware.Web.UI.Controls.carrotHelp.js"); DateTime timeAM = DateTime.Now.Date.AddHours(6); // 6AM DateTime timePM = DateTime.Now.Date.AddHours(12); // 6PM sBody = sBody.Replace("[[TIMESTAMP]]", DateTime.UtcNow.ToString("u")); sBody = sBody.Replace("[[SHORTDATEPATTERN]]", WebControlHelper.ShortDatePattern); sBody = sBody.Replace("[[SHORTTIMEPATTERN]]", WebControlHelper.ShortTimePattern); sBody = sBody.Replace("[[SHORTDATEFORMATPATTERN]]", WebControlHelper.ShortDateFormatPattern); sBody = sBody.Replace("[[SHORTDATETIMEFORMATPATTERN]]", WebControlHelper.ShortDateTimeFormatPattern); sBody = sBody.Replace("[[AM_TIMEPATTERN]]", timeAM.ToString("tt")); sBody = sBody.Replace("[[PM_TIMEPATTERN]]", timePM.ToString("tt")); context.Response.ContentType = "text/javascript"; var byteArray = Encoding.UTF8.GetBytes(sBody); using (MemoryStream memStream = new MemoryStream(byteArray)) { memStream.WriteTo(context.Response.OutputStream); } context.ApplicationInstance.CompleteRequest(); context.Response.End(); }
private void imgBool_DataBinding(object sender, EventArgs e) { Image imgBool = (Image)sender; GridViewRow container = (GridViewRow)imgBool.NamingContainer; imgBool.ImageUrl = HttpUtility.HtmlEncode(WebControlHelper.GetWebResourceUrl(imgBool.Page, this.GetType(), CarrotBooleanImageItemTemplate.IconResourcePaperclip)); try { bool bValue = Convert.ToBoolean(DataBinder.Eval(container, "DataItem." + _field).ToString()); if (bValue) { imgBool.ImageUrl = _imageTrue; imgBool.AlternateText = _verbiageTrue; } else { imgBool.ImageUrl = _imageFalse; imgBool.AlternateText = _verbiageFalse; } imgBool.ToolTip = imgBool.AlternateText; } catch { imgBool.AlternateText = _field; imgBool.ToolTip = _field; } }
public void SetImage() { _imageTrue = HttpUtility.HtmlEncode(WebControlHelper.GetWebResourceUrl(this.GetType(), CarrotBooleanImageItemTemplate.IconResourceAffirm)); _imageFalse = HttpUtility.HtmlEncode(WebControlHelper.GetWebResourceUrl(this.GetType(), CarrotBooleanImageItemTemplate.IconResourceNegative)); }
public static string GetWebResourceUrl(string resource) { return(WebControlHelper.GetWebResourceUrl(typeof(jqueryui), resource)); }
protected override void RenderContents(HtmlTextWriter output) { string sJQFile = ""; string jqVer = JQVersion; if (!string.IsNullOrEmpty(jqVer) && jqVer.Length > 2) { if (jqVer.LastIndexOf(".") != jqVer.IndexOf(".")) { jqVer = jqVer.Substring(0, jqVer.LastIndexOf(".")); } } switch (jqVer) { case "2": case "2.0": case "1.11": jqVer = "1.11.3"; sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Controls.jquery-1-11-3.js"); break; case "1.12": jqVer = "1.12.0"; sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Controls.jquery-1-12-0.js"); break; case "1.10": jqVer = "1.10.2"; sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Controls.jquery-1-10-2.js"); break; case "1.9": jqVer = "1.9.1"; sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Controls.jquery-1-9-1.js"); break; case "1.8": jqVer = "1.8.3"; sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Controls.jquery-1-8-3.js"); break; case "1.7": jqVer = "1.7.2"; sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Controls.jquery-1-7-2.js"); break; case "1": case "1.3": case "1.4": case "1.5": case "1.6": jqVer = "1.6.4"; sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Controls.jquery-1-6-4.js"); break; default: jqVer = "1.11.3"; sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Controls.jquery-1-11-3.js"); break; } output.WriteLine("<!-- JQuery v. " + jqVer + " --> <script src=\"" + sJQFile + "\" type=\"text/javascript\"></script> "); if (this.UseJqueryMigrate) { if (jqVer.StartsWith("1.9") || jqVer.StartsWith("1.10") || jqVer.StartsWith("1.11")) { sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Controls.jquery-1-2-1-mig.js"); output.WriteLine("<!-- jQuery Migrate Plugin --> <script src=\"" + sJQFile + "\" type=\"text/javascript\"></script> "); } if (jqVer.StartsWith("1.12") || jqVer.StartsWith("1.13")) { sJQFile = GetWebResourceUrl("Carrotware.Web.UI.Controls.jquery-1-3-0-mig.js"); output.WriteLine("<!-- jQuery Migrate Plugin --> <script src=\"" + sJQFile + "\" type=\"text/javascript\"></script> "); } } string key = WebControlHelper.DateKey(); output.WriteLine("<!-- Carrot Helpers --> <script src=\"/carrotwarehelper.axd?ts=" + key + "\" type=\"text/javascript\"></script> "); }
public string GetManifestResourceStream(string resource) { return(WebControlHelper.GetManifestResourceStream(resource)); }
public string GetWebResourceUrl(Page page, Type type, string resource) { return(WebControlHelper.GetWebResourceUrl(page, type, resource)); }