我在主页上要显示一些专栏的文章。下面是要求:
一幅图片(imageUrl):随不同的专栏图片也不一样。
DataGrid:绑定不同的专栏,因为都是从一个表中选取数据所以显示字段都一一样的。
A:链接,都是转到一个页。当然专栏不一样(TopicID)传递参数就不同。用户控件
声明两个属性:
protected string ImgSubjectUrl{
get{
return imgSubject.ImageUrl;
}
set{
imgSubject.ImageUrl = value:
}
}private int topicID;
protected int TopicID{
get{
return topicID;
}
set{
topicID = value;}
}
下面就是datagrid绑定数据引用页:
声明:用户控件的类名:用户控件ID
if(!ispostback)
{
用户控件ID.TopicID = XXX;
用户控件ID.ImageSubjectUrl = "YYY";
}万事大吉,复用噢可了。
我的解决方法。
http://cn.thespoke.net/MyBlog/pony/MyBlog.aspx
一幅图片(imageUrl):随不同的专栏图片也不一样。
DataGrid:绑定不同的专栏,因为都是从一个表中选取数据所以显示字段都一一样的。
A:链接,都是转到一个页。当然专栏不一样(TopicID)传递参数就不同。用户控件
声明两个属性:
protected string ImgSubjectUrl{
get{
return imgSubject.ImageUrl;
}
set{
imgSubject.ImageUrl = value:
}
}private int topicID;
protected int TopicID{
get{
return topicID;
}
set{
topicID = value;}
}
下面就是datagrid绑定数据引用页:
声明:用户控件的类名:用户控件ID
if(!ispostback)
{
用户控件ID.TopicID = XXX;
用户控件ID.ImageSubjectUrl = "YYY";
}万事大吉,复用噢可了。
我的解决方法。
http://cn.thespoke.net/MyBlog/pony/MyBlog.aspx
e.g.:[Bindable(true),
Category("Appearance"),
DefaultValue(""),Description("表头")]
public string HeaderText
{
get
{
return text;
}
set
{
text = value;
}
}
{
get { return m_ID;} set { m_ID = value;}
}
then<%Register TagName="Whatever" TagPrefix="cc" src="TOP3.ASCX" %><cc:Whatever id="w1" runat="server CategoryID="A" />
<cc:Whatever id="w2" runat="server CategoryID="B" />
<cc:Whatever id="w3" runat="server CategoryID="C" />
<cc:Whatever id="w4" runat="server CategoryID="D" />
Get
Return mDBString
End Get
Set(ByVal Value As String)
mDBString = Value
End Set
End Property