- promatrixunplugged_src.zip
- Install.Readme.txt
- ProMatrix.Common
- ProMatrix.Lib
- App_Data
- CStorage.mdf
- CStorage_log.ldf
- bin
- Debug
- App_Data
- ProMatrix.Common.dll
- ProMatrix.Lib.dll
- Controls
- CClock.cs
- CFeatures
- CMenu
- ControlBase.cs
- ControlBaseEx.cs
- CStorage
- Images
- app_frame_10.gif
- app_frame_close_10.gif
- button_forward2.gif
- button_reverse2.gif
- ddlButton_off.gif
- ddlButton_on.gif
- menu.arrow.down.png
- menu.arrow.right.png
- menu.check_off.gif
- menu.check_on.gif
- menu.radio_off.gif
- menu.radio_on.gif
- party_icon.gif
- ConversionReport.txt
- DScripts
- Images
- clockface.gif
- clockface2.gif
- copyright-side.gif
- copyright-upright.gif
- footer_info.gif
- Loading.gif
- JScripts
- obj
- Debug
- TempPE
- ProMatrix.Lib.csproj
- ProMatrix.Lib.csproj.user
- Properties
- Styles
- Support
- ProMatrix.TestControls
- App_Data
- Database.mdf
- Database_log.LDF
- Bin
- ProMatrix.Common.dll
- ProMatrix.Lib.dll
- CClock
- CFeatures
- CStorage
- Default.aspx
- Default.aspx.cs
- Unplugged
- Web.Config
- ProMatrix.Unplugged.123.sln
|
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Collections;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration;
namespace ProMatrix.Lib.UI
{
public class Rendering
{
public Page Page;
string libStylesPath;
string libScriptsPath;
string libDScriptsPath;
public Rendering(Page Page, string libStylesPath, string libScriptsPath, string libDScriptsPath)
{
this.Page = Page;
this.libStylesPath = libStylesPath;
this.libScriptsPath = libScriptsPath;
this.libDScriptsPath = libDScriptsPath;
}
//public void RenderNoScriptInfo() // just after opening form tag
//{
// if (!this.IsStartupScriptRegistered("NoScriptInfo"))
// {
// StringBuilder loadScripts = new StringBuilder();
// loadScripts.Append("<noscript ><br>");
// loadScripts.Append("<table border='0' width='99%' id='table1' height='142' style='position: absolute; left:4px; top:2px; height:100%; width:100%; z-index:500' bgcolor='#FFFFFF'>");
// loadScripts.Append("<tr>");
// loadScripts.Append("<td align='left' valign='top'>");
// loadScripts.Append("<p align='center'>JavaScript Error: This application requires JavaScript.<br>");
// loadScripts.Append("Your browser must have JavaScript enabled for this application to function.<br>");
// loadScripts.Append("<a href='" + findFolder("calendar") + "ProMatrix.Common/FAQ/browserSettings.htm'>Click here for details on how to ");
// loadScripts.Append("enable JavaScript for this application.</a><br>");
// loadScripts.Append(" </p>");
// loadScripts.Append("</td>");
// loadScripts.Append("</tr>");
// loadScripts.Append("</table>");
// loadScripts.Append("</noscript><br>");
// RegisterClientScriptBlock("NoScriptInfo", loadScripts.ToString());
// }
//}
#region Shortcut icon
//
#endregion
#region Stylesheet
public void StylesheetFile(string id) // in the Styles folder
{
string cssFile = libStylesPath + id;
StylesheetFile(id, cssFile);
}
public void StylesheetFile(string id, string cssFile) // in the header
{
cssFile = cssFile.ToLower() + ".css";
HtmlHead HtmlHead = null;
for (int i = 0; i < Page.Controls.Count; i++)
{
Type t = Page.Controls[i].GetType();
if (Page.Controls[i].GetType().ToString() == "System.Web.UI.HtmlControls.HtmlHead")
{
HtmlHead = (HtmlHead)Page.Controls[i];
for (int j = 0; j < HtmlHead.Controls.Count; j++)
{
Control Control = (Control)HtmlHead.Controls[j];
if (Control.GetType().ToString() == "System.Web.UI.LiteralControl")
{
LiteralControl LiteralControl = (LiteralControl)HtmlHead.Controls[j];
if(LiteralControl.Text.IndexOf("href='" + cssFile + "'") != -1)
return;
}
}
}
}
if (HtmlHead != null)
HtmlHead.Controls.Add(new LiteralControl("<link id='" + id + "' href='" + cssFile + "' rel='stylesheet' type='text/css' /> \r\n"));
}
#endregion
#region JavaScript
public void StartupLibJsFile(string scriptName)
{
StartupJsFile(libScriptsPath + scriptName);
}
public void StartupLibDJsFile(string scriptName)
{
StartupJsFile(libDScriptsPath + scriptName);
}
public void StartupDefaultJsFile(string sDefault)
{ // only use with served page
string CurrentExecutionFilePath = Page.Request.CurrentExecutionFilePath.Substring(0, Page.Request.CurrentExecutionFilePath.LastIndexOf('/'));
StartupJsFile(CurrentExecutionFilePath + "/JScripts/" + sDefault);
}
public void StartupJsFile(string scriptName) // just after opening form tag
{
scriptName = scriptName.ToLower() + ".js";
StringBuilder loadScripts = new StringBuilder();
loadScripts.Append("<script type='text/javascript' language='JavaScript' src='" + scriptName + "'></script>\r\n");
Page.ClientScript.RegisterClientScriptBlock(typeof(String), scriptName, loadScripts.ToString());
}
public void EndingLibJsFile(string scriptName)
{
EndingJsFile(libScriptsPath + scriptName);
}
public void EndingJsFile(string scriptName) // just before closing form tag
{
scriptName = scriptName.ToLower() + ".js";
StringBuilder loadScripts = new StringBuilder();
loadScripts.Append("<script type='text/javascript' language='JavaScript' src='" + scriptName + "'></script>");
Page.ClientScript.RegisterStartupScript(typeof(String), scriptName, loadScripts.ToString());
}
public void StartupJsCode(string scriptName, string script) // just after opening form tag
{
scriptName = scriptName.ToLower();
StringBuilder loadScripts = new StringBuilder();
loadScripts.Append("<script language='JavaScript'>\r\n" + script + "\r\n</script>\r\n\r\n");
Page.ClientScript.RegisterClientScriptBlock(typeof(String), scriptName, loadScripts.ToString());
}
public void EndingJsCode(string scriptName, string script) // just before closing form tag
{
scriptName = scriptName.ToLower();
StringBuilder loadScripts = new StringBuilder();
loadScripts.Append("<script language='JavaScript'>\r\n" + script + "\r\n</script>\r\n\r\n");
Page.ClientScript.RegisterStartupScript(typeof(String), scriptName, loadScripts.ToString());
}
public void DivOpening(string scriptName, string style)
{
StringBuilder loadScripts = new StringBuilder();
loadScripts.Append("<div style='" + style + "'>\r\n");
Page.ClientScript.RegisterClientScriptBlock(typeof(String), scriptName, loadScripts.ToString());
}
public void DivClosing(string scriptName)
{
StringBuilder loadScripts = new StringBuilder();
loadScripts.Append("</div>\r\n\r\n");
Page.ClientScript.RegisterClientScriptBlock(typeof(String), scriptName, loadScripts.ToString());
}
public string concatScriptCommand(string arg, string val)
{
return arg + " = \"" + val + "\";\r\n";
}
public string concatScriptCommand(string arg, int val)
{
return arg + " = " + val + ";\r\n";
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
My formal education was in Electronic Engineering with a background in real-time data acquisition for aerospace. Early in my career, I switched my focus from hardware engineering to software engineering. Most, but not all, of my development experience has been using Microsoft technologies and tools. My current accomplishments are web applications using ASP.Net, SQL Server 2005, JavaScript, and Visual Studio Tools for Office. I enjoy all facets of a development life cycle, and have played almost all roles. Most recently, I have been involved in project technical leadership, architecture, and training, and I have created several small courses including this one on
Abstract Programming.