Results 1 to 6 of 6

Thread: ImageUrl in ASP.net

  1. #1
    Join Date
    Dec 2009
    Posts
    39

    ImageUrl in ASP.net

    Hello,
    I am basic learner in asp.net and want to know some of the details about the ImageUrl from it. If anyone from you is having details about it, then please provide details about it, so I can able to use it in my program while creating program in the ASP.net. So, if you are having details about ImageUrl in ASP.net , then provide that to me.

  2. #2
    Join Date
    Nov 2005
    Posts
    1,323

    Re: ImageUrl in ASP.net

    If you want to make use of the imageURL in your program then you just need to make use of the following code in your program:
    Code:
    public string imageURL(string image)
    {
       return ("retrieveImages.aspx?id=" + image);
    }
    This function is used to take URL of particular image form the internet.

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: ImageUrl in ASP.net

    Hello, I have got the following program line code which will be helpful to you for getting the details of the ImageUrl in your program. By the use of it, you can able to bind the url path in the aspx page directly
    Code:
    <asp:Image ID="picture" runat="server" ImageUrl='<%# "Intranet/Marketing/MerchImage/" + DataBinder.Eval(Container.DataItem, "First")%>' >

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: ImageUrl in ASP.net

    I have the code below which can be used into the Grid View control for binding the imageURL function created at server end.
    Code:
    <asp:TemplateField>
    <ItemTemplate>
    <asp:Image ID="savedone" runat="server" ImageUrl='<%# imageURL(DataBinder.Eval(Container.DataItem, "picture").ToString()) %>'
    AlternateText='<%#DataBinder.Eval(Container.DataItem,"picture_name") %>' />
    </ItemTemplate>
    </asp:TemplateField>

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: ImageUrl in ASP.net

    Hello, you need to use the below souce code in your program
    Code:
    <asp:Image ID="img1" runat="server" ImageUrl='<%#
    DataBinder.Eval(Container.DataItem, "First") %>.jpg' />
    But if you are not getting this then you can simply make use of the folowing code for using the ImageUrl in your program by making a method:

    Code:
    <asp:Image ID="img1" runat="server" ImageUrl='<%# checking(
    DataBinder.Eval(Container.DataItem, "First") ) %' />
    protected string checking(object urlP)
    {
    return (string)urlP +".jpg";
    }

  6. #6
    Join Date
    Jan 2008
    Posts
    1,521

    Re: ImageUrl in ASP.net

    Hello, I have following jsp page which will simply make use of the ImageUrl in the program for setting imageUrl in asp:
    HTML Code:
    <%@ Page Language="VB" %>
    <script runat="server">
        Sub b1_Click(sender As Object, e As EventArgs)
          l3.Visible = False
          l1.Text = Int(Rnd() * 6) + 1
          l2.Text = Int(Rnd() * 6) + 1
        
          img2.ImageUrl = "http://www.techarena.in/style/design.png"
          img3.ImageUrl = "http://www.techarena.in/style/design.png"
        
          If l1.Text = "1" And l2.Text = "1" Then
            l5.Text = l4.Text
            If CInt(l5.Text) > CInt(l6.Text) Then
              l6.Text = l5.Text
              Panel1.Visible = True
            End If
            l4.Text = 0
            l3.Visible = True
          Else
            l4.Text = CInt(l4.Text) + CInt(l1.Text) + CInt(l2.Text)
          End If
        End Sub
        
        Sub b2_Click(sender As Object, e As EventArgs)
          l6.Text = 0
        End Sub
        
        Sub b3_Click(sender As Object, e As EventArgs)
          Panel1.Visible = False
        End Sub
    
    </script>
    <html>
    <head>
    </head>
    <body>
        <form runat="server">
            <p>
                <asp:Label id="l1" runat="server" Height="44px" Font-Size="X-Large" Font-Names="Verdana" BorderStyle="Solid">0</asp:Label>
                <asp:Label id="l2" runat="server" Height="44px" Font-Size="X-Large" Font-Names="Verdana" BorderStyle="Solid">0</asp:Label>
            </p>
            <p>
                <asp:Image id="img2" runat="server"></asp:Image>
                <asp:Image id="img3" runat="server"></asp:Image>
            </p>
            <p>
                <asp:Label id="l3" runat="server" Visible="False">Ooops, you did it again :(</asp:Label>
            </p>
            <p>
                <asp:Button id="b1" onclick="b1_Click" runat="server" Text="Click on it..."></asp:Button>
            </p>
            <p>
                <asp:Label id="l4" runat="server" Font-Size="X-Large" Font-Names="Verdana" ForeColor="Red">0</asp:Label>
            </p>
            <p>
                Last Score: 
                <asp:Label id="l5" runat="server" Font-Size="X-Large" Font-Names="Verdana" ForeColor="Red">0</asp:Label>
            </p>
            <p>
                High Score: 
                <asp:Label id="l6" runat="server" Font-Size="X-Large" Font-Names="Verdana" ForeColor="Red">0</asp:Label>
            </p>
            <p>
                <asp:Button id="b2" onclick="b2_Click" runat="server" Text="Reset High Scores"></asp:Button>
            </p>
            <p>
                <asp:Panel id="Panel1" style="Z-INDEX: 100; LEFT: 192px; POSITION: absolute; TOP: 421px" runat="server" Visible="False">
                    <p>
                        Ok, now submit.
                    </p>
                    <p>
                        Name: 
                        <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
                    </p>
                    <p>
                        E-mail: 
                        <asp:TextBox id="TextBox2" runat="server"></asp:TextBox>
                    </p>
                    <p>
                        &nbsp;<asp:Button id="b3" onclick="b3_Click" runat="server" Text="submit"></asp:Button>
                    </p>
                </asp:Panel>
            </p>
        </form>
    </body>
    </html>

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,721,933,019.85328 seconds with 16 queries