易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET动态加载用户控件的页面生成过程

  MainPage文件:WebForm1.aspx
    <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="TestMasterPage.WebForm1" enableViewState="False"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>WebForm1</title>
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder></form>
    </body>
    </HTML>
    WebForm1.aspx.cs
    using System;
    using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls;
    namespace TestMasterPage
    {
    /// <summary>
    /// WebForm1 的摘要说明。
    /// </summary>
    public class WebForm1 : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.PlaceHolder PlaceHolder1; private void Page_Load(object sender, System.EventArgs e)
    {
    //在此处放置用户代码以初始化页面
    string controlName = "search.ascx";
    UserControl control = (UserControl)LoadControl("~/skins/default/controls/"+ controlName);
    control.ID = "ID_" + controlName; PlaceHolder1.Controls.Add(control); Response.Write("only trace..");
    }
    Web窗体设计器生成的代码Web窗体设计器生成的代码
    override protected void OnInit(EventArgs e)


相关文档:

asp.net母版页使用控件时,控件中路径问题

刚刚在headmenu控件里面写了一个导航条,用到了本地的图片,在控件中显示良好,可是放到母版式页后,发现导航条背景图片没了,于是仔细检查了下图片的url,我用的是绝对路径,难道放在主页上后,路径也改变了,上网查了下,还真是这个问题,图片在控件里面看不到没关系,关键是要在母版式页能看到就行,路径都要根据母版页的写. ......

asp.net 获取网站根目录

获取网站根目录的方法有几种如:
Server.MapPath(Request.ServerVariables["PATH_INFO"])
 Server.MapPath("/")
 Server.MapPath("")
Server.MapPath(".")
 Server.MapPath("../")
 Server.MapPath("..")
  &nb ......

ASP.NET编程模型之ASP.NET页面生命周期图解

ASP.NET编程模型之ASP.NET页面生命周期图解
ASP.NET编程模型中ASP.NET页面生命周期是指什么呢?它包括什么呢?ASP.NET编程模型之ASP.NET页面生命周期具体的过程有哪些呢?下面就开始我们的讲解吧:
ASP.NET 页运行时,此页将经历一个生命周期,在生命周期中将执行一系列处理步骤。这些步骤包括初始化、实例化控件、还原和 ......

ASP.NET自定义控件事件响应

1.重载protected override bool OnBubbleEvent(object source, EventArgs args)
OnBubbleEvent是控件内包含的控件向外层控件作事件冒泡
-------------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Co ......

asp.net 对 文件进行压缩 or 解压(zip

asp.net 对 文件进行压缩 or 解压(zip)
/// <summary>
/// 对文件进行(压缩,解压)
/// </summary>
public static class ZIP
{
/// <summary>压缩文件</summary>
/// <param name="filename">filename生成的文件的名称,如:C\123\123.zip</param>
/// <param name="d ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号