?????求救,一个VS05中ASP.NET用户控件的问题,在线等高手
下面是一个用户控件new_mov.ascx,里面包含两个控件Image Image1和HyperLink HyperLink1
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class new_mov : System.Web.UI.UserControl
{
private string M_id=String.Empty ;
private string M_imageurl = String.Empty;
private string M_movname = String.Empty;
//空构造
public new_mov()
{ }
//构造2
public new_mov(string tid,string timageurl,string tmovname)
{
M_id = tid;
M_imageurl = timageurl;
M_movname = tmovname;
}
#region 控件属性
public string id
{
set { M_id = value; }
get { return M_id; }
}
public string imageurl
{
set { M_imageurl = value; }
get { return M_imageurl; }
}
public string name
{
set { M_movname = value; }
get { return M_movname; }
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
Image1.ImageUrl = this.imageurl;
HyperLink1.NavigateUrl = this.id;
HyperLink1.Text = this.name;
}
}
下面是在Default.aspx中引用它,目的是动态生成控件
Default.aspx源
<%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "Default.aspx.cs " Inherits= "_Default " %>
<%@ Reference VirtualPath= "~/new_mov.ascx " %>