J
Jeff
hey
asp.net 2.0
I'm trying to make a webpage that shows a list of pictures. When the user
clicks on a picture, the user is redirected to another page in my website.
The links are generated at runtime
My code crashes during runtime because of a variable in the ItemDataBound
event is null. Below I show my problem code and maybe some of you could give
me a suggestion to what should do to fix this...
<td rowspan="2"><a id="LinkToProfile" href=""><asp:Image ID="MemberPhoto"
runat="server" ImageAlign="Left" /></a></td>
System.Web.UI.HtmlControls.HtmlAnchor link = null;
link =
(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("LinkToProfile");
link.HRef = "../test.aspx?id=" + subscriber.UserName;
My code crashes because the variable "link" is null after this line "link =
(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("LinkToProfile");"
Any suggestions that may solve this problem are very welcome
Jeff
asp.net 2.0
I'm trying to make a webpage that shows a list of pictures. When the user
clicks on a picture, the user is redirected to another page in my website.
The links are generated at runtime
My code crashes during runtime because of a variable in the ItemDataBound
event is null. Below I show my problem code and maybe some of you could give
me a suggestion to what should do to fix this...
<td rowspan="2"><a id="LinkToProfile" href=""><asp:Image ID="MemberPhoto"
runat="server" ImageAlign="Left" /></a></td>
System.Web.UI.HtmlControls.HtmlAnchor link = null;
link =
(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("LinkToProfile");
link.HRef = "../test.aspx?id=" + subscriber.UserName;
My code crashes because the variable "link" is null after this line "link =
(System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("LinkToProfile");"
Any suggestions that may solve this problem are very welcome

Jeff