HyperLink Column in DataGrid

Discussion in 'ASP .Net' started by Samuel Shulman, Dec 6, 2006.

  1. I am trying to add HyperLink column with an image

    Below is the code that I use
    <asp:TemplateField>

    <ControlStyle Height="75px" Width="75px" />

    <ItemStyle Height="75px" Width="75px" />

    <ItemTemplate>

    <asp:HyperLink ID="HPF1" runat="server" Height="75px" Width="75px"
    ImageUrl='<%# Eval("ImageFilePath") %>' NavigateUrl='<%# Eval("ProductURL")
    %>' />

    </ItemTemplate>

    </asp:TemplateField>


    The problem is that the image appears in it's original size and I want it to
    be 75px / 75px only

    Thank you,
    Samuel
    Samuel Shulman, Dec 6, 2006
    #1
    1. Advertising

  2. Samuel you aren't giving the image the height and width but the hyperlink.
    if you want to use the asp:hyperlink then just resize it

    "Samuel Shulman" <> wrote in message
    news:%...
    > I am trying to add HyperLink column with an image
    >
    > Below is the code that I use
    > <asp:TemplateField>
    >
    > <ControlStyle Height="75px" Width="75px" />
    >
    > <ItemStyle Height="75px" Width="75px" />
    >
    > <ItemTemplate>
    >
    > <asp:HyperLink ID="HPF1" runat="server" Height="75px" Width="75px"
    > ImageUrl='<%# Eval("ImageFilePath") %>' NavigateUrl='<%#

    Eval("ProductURL")
    > %>' />
    >
    > </ItemTemplate>
    >
    > </asp:TemplateField>
    >
    >
    > The problem is that the image appears in it's original size and I want it

    to
    > be 75px / 75px only
    >
    > Thank you,
    > Samuel
    >
    >
    >
    Patrick.O.Ige, Dec 7, 2006
    #2
    1. Advertising

  3. I can't actually size the picture but I do size the HyperLink

    The idea is to have the image within the HyperLink so users can click on the
    image and navigate the product's page

    Regards,
    Samuel



    "Patrick.O.Ige" <> wrote in message
    news:%...
    > Samuel you aren't giving the image the height and width but the hyperlink.
    > if you want to use the asp:hyperlink then just resize it
    >
    > "Samuel Shulman" <> wrote in message
    > news:%...
    >> I am trying to add HyperLink column with an image
    >>
    >> Below is the code that I use
    >> <asp:TemplateField>
    >>
    >> <ControlStyle Height="75px" Width="75px" />
    >>
    >> <ItemStyle Height="75px" Width="75px" />
    >>
    >> <ItemTemplate>
    >>
    >> <asp:HyperLink ID="HPF1" runat="server" Height="75px" Width="75px"
    >> ImageUrl='<%# Eval("ImageFilePath") %>' NavigateUrl='<%#

    > Eval("ProductURL")
    >> %>' />
    >>
    >> </ItemTemplate>
    >>
    >> </asp:TemplateField>
    >>
    >>
    >> The problem is that the image appears in it's original size and I want it

    > to
    >> be 75px / 75px only
    >>
    >> Thank you,
    >> Samuel
    >>
    >>
    >>

    >
    >
    Samuel Shulman, Dec 7, 2006
    #3
  4. Hi Samuel,
    If thats the case then do this
    <asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="ID"
    DataNavigateUrlFormatString="yourlaspx?ID={0}"
    Text="<img border='0'
    src='/images/yourimage.gif' />"></asp:HyperLinkColumn>
    In the Text="<img border='0' src='/images/yourimage.gif' / height='75px'
    width='75px'>"
    in Text property resize your image as above
    Hope that helps
    Patrick

    "Samuel Shulman" <> wrote in message
    news:...
    > I can't actually size the picture but I do size the HyperLink
    >
    > The idea is to have the image within the HyperLink so users can click on

    the
    > image and navigate the product's page
    >
    > Regards,
    > Samuel
    >
    >
    >
    > "Patrick.O.Ige" <> wrote in message
    > news:%...
    > > Samuel you aren't giving the image the height and width but the

    hyperlink.
    > > if you want to use the asp:hyperlink then just resize it
    > >
    > > "Samuel Shulman" <> wrote in message
    > > news:%...
    > >> I am trying to add HyperLink column with an image
    > >>
    > >> Below is the code that I use
    > >> <asp:TemplateField>
    > >>
    > >> <ControlStyle Height="75px" Width="75px" />
    > >>
    > >> <ItemStyle Height="75px" Width="75px" />
    > >>
    > >> <ItemTemplate>
    > >>
    > >> <asp:HyperLink ID="HPF1" runat="server" Height="75px" Width="75px"
    > >> ImageUrl='<%# Eval("ImageFilePath") %>' NavigateUrl='<%#

    > > Eval("ProductURL")
    > >> %>' />
    > >>
    > >> </ItemTemplate>
    > >>
    > >> </asp:TemplateField>
    > >>
    > >>
    > >> The problem is that the image appears in it's original size and I want

    it
    > > to
    > >> be 75px / 75px only
    > >>
    > >> Thank you,
    > >> Samuel
    > >>
    > >>
    > >>

    > >
    > >

    >
    >
    Patrick.O.Ige, Dec 7, 2006
    #4
  5. That works,

    Thank you

    Samuel

    "Patrick.O.Ige" <> wrote in message
    news:...
    > Hi Samuel,
    > If thats the case then do this
    > <asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="ID"
    > DataNavigateUrlFormatString="yourlaspx?ID={0}"
    > Text="<img border='0'
    > src='/images/yourimage.gif' />"></asp:HyperLinkColumn>
    > In the Text="<img border='0' src='/images/yourimage.gif' / height='75px'
    > width='75px'>"
    > in Text property resize your image as above
    > Hope that helps
    > Patrick
    >
    > "Samuel Shulman" <> wrote in message
    > news:...
    >> I can't actually size the picture but I do size the HyperLink
    >>
    >> The idea is to have the image within the HyperLink so users can click on

    > the
    >> image and navigate the product's page
    >>
    >> Regards,
    >> Samuel
    >>
    >>
    >>
    >> "Patrick.O.Ige" <> wrote in message
    >> news:%...
    >> > Samuel you aren't giving the image the height and width but the

    > hyperlink.
    >> > if you want to use the asp:hyperlink then just resize it
    >> >
    >> > "Samuel Shulman" <> wrote in message
    >> > news:%...
    >> >> I am trying to add HyperLink column with an image
    >> >>
    >> >> Below is the code that I use
    >> >> <asp:TemplateField>
    >> >>
    >> >> <ControlStyle Height="75px" Width="75px" />
    >> >>
    >> >> <ItemStyle Height="75px" Width="75px" />
    >> >>
    >> >> <ItemTemplate>
    >> >>
    >> >> <asp:HyperLink ID="HPF1" runat="server" Height="75px" Width="75px"
    >> >> ImageUrl='<%# Eval("ImageFilePath") %>' NavigateUrl='<%#
    >> > Eval("ProductURL")
    >> >> %>' />
    >> >>
    >> >> </ItemTemplate>
    >> >>
    >> >> </asp:TemplateField>
    >> >>
    >> >>
    >> >> The problem is that the image appears in it's original size and I want

    > it
    >> > to
    >> >> be 75px / 75px only
    >> >>
    >> >> Thank you,
    >> >> Samuel
    >> >>
    >> >>
    >> >>
    >> >
    >> >

    >>
    >>

    >
    >
    Samuel Shulman, Dec 8, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?V2FyYW4=?=

    HyperLink Column and Button Column in a DataGrid

    =?Utf-8?B?V2FyYW4=?=, Aug 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    588
    =?Utf-8?B?V2FyYW4=?=
    Aug 9, 2005
  2. =?Utf-8?B?ZGF2aWQ=?=
    Replies:
    11
    Views:
    988
    deandany
    Jul 17, 2006
  3. davetichenor
    Replies:
    1
    Views:
    794
    Eliyahu Goldin
    Oct 30, 2006
  4. Keith G Hicks
    Replies:
    3
    Views:
    734
    Keith G Hicks
    Feb 18, 2008
  5. Dave
    Replies:
    0
    Views:
    918
Loading...

Share This Page