本文整理汇总了C#中Page.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Page.GetType方法的具体用法?C# Page.GetType怎么用?C# Page.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page.GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintWebControl
public static void PrintWebControl(Control ctrl, string Script)
{
StringWriter stringWrite = new StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
if (ctrl is WebControl)
{
Unit w = new Unit(100, UnitType.Percentage); ((WebControl)ctrl).Width = w;
}
Page pg = new Page();
pg.EnableEventValidation = false;
if (Script != string.Empty)
{
pg.ClientScript.RegisterStartupScript(pg.GetType(), "PrintJavaScript", Script);
pg.ClientScript.RegisterStartupScript(pg.GetType(), "ScriptManager", Script);
}
HtmlForm frm = new HtmlForm();
pg.Controls.Add(frm);
frm.Attributes.Add("runat", "server");
frm.Controls.Add(ctrl);
pg.DesignerInitialize();
pg.RenderControl(htmlWrite);
string strHTML = stringWrite.ToString();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write(strHTML);
HttpContext.Current.Response.Write("<script>window.print();</script>");
HttpContext.Current.Response.End();
}
示例2: AlertAndRedirect
/// <summary>
/// 弹出消息框并且转向到新的URL
/// </summary>
/// <param name="message">消息内容</param>
/// <param name="toURL">连接地址</param>
/// <param name="page">Page类的实例</param>
public static void AlertAndRedirect(string message, string toURL, Page page)
{
#region
string js = "<script language=javascript>alert('{0}');window.location.replace('{1}')</script>";
if (!page.ClientScript.IsStartupScriptRegistered(page.GetType(), "AlertAndRedirect"))
{
page.ClientScript.RegisterStartupScript(page.GetType(), "AlertAndRedirect", string.Format(js, message, toURL));
}
#endregion
}
示例3: Alert
/// <summary>
/// 弹出JavaScript小窗口
/// </summary>
/// <param name="message">窗口信息</param>
/// <param name="page">Page类的实例</param>
public static void Alert(string message, Page page)
{
#region
string js = @"<Script language='JavaScript'>
alert('" + message + "');</Script>";
if (!page.ClientScript.IsStartupScriptRegistered(page.GetType(), "alert"))
{
page.ClientScript.RegisterStartupScript(page.GetType(), "alert", js);
}
#endregion
}
示例4: GoHistory
/// <summary>
/// 回到历史頁面
/// </summary>
/// <param name="value">-1/1</param>
public static void GoHistory(int value, Page page)
{
#region
string js = @"<Script language='JavaScript'>
history.go({0});
</Script>";
//HttpContext.Current.Response.Write(string.Format(js, value));
if (!page.ClientScript.IsStartupScriptRegistered(page.GetType(), "GoHistory"))
{
page.ClientScript.RegisterStartupScript(page.GetType(), "GoHistory", string.Format(js, value));
}
#endregion
}
示例5: JavaScriptLocationHref
/// <summary>
/// 转向Url制定的頁面
/// </summary>
/// <param name="url">连接地址</param>
public static void JavaScriptLocationHref(string url, Page page)
{
#region
string js = @"<Script language='JavaScript'>
window.location.replace('{0}');
</Script>";
js = string.Format(js, url);
//HttpContext.Current.Response.Write(js);
if (!page.ClientScript.IsStartupScriptRegistered(page.GetType(), "JavaScriptLocationHref"))
{
page.ClientScript.RegisterStartupScript(page.GetType(), "JavaScriptLocationHref", js);
}
#endregion
}
示例6: DoSuccessClose
public static void DoSuccessClose(string str, string reload, Page page)
{
if (str == "")
{
str = "操作信息成功!";
}
if (reload == "MainAddUpdate")
{
ScriptManager.RegisterClientScriptBlock(page, page.GetType(), "show", "window.opener.parent.ShowMsg_TS('" + str + "');window.close();", true);
}
else
{
ScriptManager.RegisterClientScriptBlock(page, page.GetType(), "show", "alert('" + str + "');window.opener.location.reload();window.close();", true);
}
}
示例7: MessageBox
/// <summary>
/// ��ʾ��ʾ��
/// </summary>
/// <param name="page"></param>
/// <param name="Content"></param>
public static void MessageBox(Page page, string Content)
{
if (page.ClientScript.IsStartupScriptRegistered("alert") != true)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "alert", "<script>function ShowAlert(){alert('" + Content + "');}window.onload=ShowAlert;</script>");
}
}
示例8: Alert
public void Alert(string message, Page page)
{
ScriptManager.RegisterStartupScript(page, page.GetType(),
"err_msg",
"alert('" + message + "');",
true);
}
示例9: RegisterScript
public void RegisterScript(Page page, string ScriptContent)
{
string str = "<script> \n " +ScriptContent+" \n </script>";
//page.RegisterStartupScript("s1",str);
page.ClientScript.RegisterStartupScript(page.GetType(), DateTime.Now.ToLongTimeString(), str);
}
示例10: ShowMessage
/// <summary>
/// 信息提示框
/// </summary>
/// <param name="page">Page 对象</param>
/// <param name="Message">提示信息</param>
public void ShowMessage(Page page,string Message)
{
string str = "<script> "+
" alert('" + Message.Replace("'", "").Replace("\r", "").Replace("\n", "").Replace("\t", "") + "');\n"+
"</script>";
page.ClientScript.RegisterStartupScript(page.GetType(), DateTime.Now.ToLongTimeString(), str);
}
示例11: SCAlert
/// <summary>
/// 弹出
/// </summary>
/// <param name="text"></param>
/// <param name="page"></param>
public static void SCAlert(string message, string type, string oComplete, Page page)
{
string functionName = "notify";
switch (type)
{
case "Success":
functionName = "notify_s";
break;
case "Info":
functionName = "notify_i";
break;
case "Error":
functionName = "notify_e";
break;
default:
functionName = "notify";
break;
}
string Script = "";
if (!string.IsNullOrEmpty(oComplete))
Script = "<Script language='JavaScript'>$(document).ready(function () {" + functionName + "('" + type + "', '" + message + "');setTimeout('" + oComplete + "',2000);});</Script>";
else
Script ="<Script language='JavaScript'>$(document).ready(function () {"+functionName+"('"+type+"', '"+message+"');});</Script>";
page.ClientScript.RegisterStartupScript(page.GetType(), "alert", Script);
}
示例12: ShowPopUpMsg
public static void ShowPopUpMsg(string msg, Page objPage)
{
StringBuilder sb = new StringBuilder();
sb.Append("alert('");
sb.Append(msg.Replace("\n", "\\n").Replace("\r", "").Replace("'", "\\'"));
sb.Append("');");
System.Web.UI.ScriptManager.RegisterStartupScript(objPage, objPage.GetType(), "showalert", sb.ToString(), true);
}
示例13: DoSuccessNoClose
public static void DoSuccessNoClose(string str, string url, Page page)
{
if (str == "")
{
str = "操作信息成功!";
}
ScriptManager.RegisterClientScriptBlock(page, page.GetType(), "show", "alert('" + str + "');document.location.href='" + url + "';window.opener.location.reload();", true);
}
示例14: OpenPage
public static void OpenPage(string str, int width, int height, Page page)
{
string s = HttpContext.Current.Request.Cookies["allwid"].Value;
string str3 = HttpContext.Current.Request.Cookies["allhei"].Value;
int num = ((int.Parse(s) - 10) - width) / 2;
int num2 = ((int.Parse(str3) - 30) - height) / 2;
ScriptManager.RegisterClientScriptBlock(page, page.GetType(), "open", "window.open('" + str + "', '', 'toolbar=no,status=no,resizable=no,width=" + width.ToString() + "px,height=" + height.ToString() + "px,scrollbars=no,location=no,left=" + num.ToString() + "px,top=" + num2.ToString() + "px');", true);
}
示例15: DoSuccessOpen
public static void DoSuccessOpen(string str, Page page)
{
if (str == "")
{
str = "操作信息成功!";
}
ScriptManager.RegisterClientScriptBlock(page, page.GetType(), "show", "window.alert('" + str + "');window.opener.location.reload();window.close();", true);
}