P
Pete Davis
I'm fairly weak with ASP.NET. What I'm trying to do is pass an attribute to
a UserControl. The attribute is a value from the CodeBehind for the page.
So in my .aspx I have the following:
<cm:Comments runat="server" ID="Comments1" CommentType="News" ItemID="<%=
NewsItemID %>" />
NewsItemID is a property in the CodeBehind for the page.
However when I get to the Page_Load of the UserControl and do the following:
int itemID = Convert.ToInt32(this.Attributes["ItemID"]);
it throws an exception because the value of this.Attributes["ItemID"] is <%=
NewsItemID %>
Obviously, not what I wanted.
Is there a proper way to do this?
Thanks.
Pete
a UserControl. The attribute is a value from the CodeBehind for the page.
So in my .aspx I have the following:
<cm:Comments runat="server" ID="Comments1" CommentType="News" ItemID="<%=
NewsItemID %>" />
NewsItemID is a property in the CodeBehind for the page.
However when I get to the Page_Load of the UserControl and do the following:
int itemID = Convert.ToInt32(this.Attributes["ItemID"]);
it throws an exception because the value of this.Attributes["ItemID"] is <%=
NewsItemID %>
Obviously, not what I wanted.
Is there a proper way to do this?
Thanks.
Pete