日期:2014-05-18 浏览次数:20405 次
public string adClassID = ""; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Response.Write(adClassID + "--"); } }
<%@ Register TagPrefix="jav" TagName="indexNav" src="userControl/indexNav.ascx" %> ..... <jav:indexNav id="UC_indexNav8" adClassID="<%#class_forumid1%>" runat="server"></jav:indexNav>
public string class_forumid1 = "0"; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { class_forumid1="10"; } }
<%@ Register TagPrefix="jav" TagName="indexNav" src="userControl/indexNav.ascx" %> ..... <jav:indexNav id="UC_indexNav8" adClassID="<%#class_forumid1%>" runat="server"></jav:indexNav>
------解决方案--------------------
上面第一段C#改为
if (!Page.IsPostBack) { class_forumid1="10"; UC_indexNav8.DataBind();//这样结果就显示adClassID="10" }