Asp.net, vb.net, C#.net Resources

Welcome to Asp.net, vb.net, C#.net Resources Sign in | Join | Help
in Search

How to change the imageurl of the image control that exists in a usercontrol?

Last post 08-22-2006, 8:36 AM by Webdeveloper. 1 replies.
Sort Posts: Previous Next
  •  08-21-2006, 4:41 AM 303

    How to change the imageurl of the image control that exists in a usercontrol?

    How to change the imageurl of the image control that exists in a usercontrol?
  •  08-22-2006, 8:36 AM 742 in reply to 303

    Re: How to change the imageurl of the image control that exists in a usercontrol?

    In the .ascx:


    <asp:Image id="Image1" runat="server"></asp:Image>


    In .aspx

    VB.NET


    <uc1:UCImage id="UCImage1" source="b2346.jpg" runat="server"></uc1:UCImage>

    Dim UC As UserControl
    Dim imgUC As System.Web.UI.WebControls.Image
    UC = Page.FindControl("UCImage1")
    imgUC = UC.FindControl("Image1")
    imgUC.ImageUrl = "b2346.jpg"


    C#


    UserControl UC ;
    System.Web.UI.WebControls.Image imgUC ;
    UC = (UserControl)Page.FindControl("UCImage1");
    imgUC =(System.Web.UI.WebControls.Image)UC.FindControl("Image1");
    imgUC.ImageUrl = "b2346.jpg";

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems