How to Use Image Button as hyperlink

7 posts, 0 answers
  1. AL
    AL avatar
    40 posts
    Member since:
    May 2008

    Posted 13 May 2008 Link to this post

    How to use an Image button as a hyperlink in a radGrid?

    I have a grid that displays customerID, firstname, lastname. The customerID field contains "View Details" image. When I click the "View Details" image button, I want the user to be redirected to: customerdetails.aspx?customerID = ALFKI

    The following code does not work for an imageButton:-
    CommandArgument="customerdetails.aspx?customerID=customerID.....does not work.

    Appreciate your help.

    Luv.

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 May 2008 Link to this post

    Hi Luv,

    Try the following code snippet to achieve the desired scenario.

    ASPX:
    <telerik:GridTemplateColumn HeaderText="Temp" UniqueName="Temp" > 
                          <HeaderTemplate> 
                             <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/RadControls/Hay/Grid/AddRecord.gif" OnClick="ImageButton1_Click" /> 
                           </HeaderTemplate> 
       </telerik:GridTemplateColumn> 


    CS:
     protected void ImageButton1_Click(object sender, ImageClickEventArgs e) 
        { 
            Response.Redirect("~/customerdetails.aspx"); 
        } 


    Thanks
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. AL
    AL avatar
    40 posts
    Member since:
    May 2008

    Posted 14 May 2008 Link to this post

    Hi Shinu,

    The code you are suggesting may work in older version of radGrid (2007), but not in 2008 Q1. I get error on ImageClickEventArgs e

    I am trying to achieve the following action, but I get errors on CommandName and CommandArguments:--

    protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.CommandName == "viewdetails")
            {

                Response.Redirect("~/customerdetails.aspx?CustomerID=" + e.CommandArgument);

            }
        }


  5. AL
    AL avatar
    40 posts
    Member since:
    May 2008

    Posted 14 May 2008 Link to this post

    It seems Raju Kumar has the same request:--

    Binding OnitemCommand event:

    http://www.telerik.com/community/forums/thread/b311D-bdtmhb.aspx

    ANy CORRECT and UPDATED telerik Grid documentation will be greatly appreciated. I downloaded the latest documentation, but it contains documentation for 2007 version???????
  6. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 15 May 2008 Link to this post

    Hello Luv,

    The latest version of the online documentation of RadControls for ASP.NET AJAX can be found here:

    http://www.telerik.com/help/aspnet-ajax/introduction.html

    It will be updated by the end of the week along with the Q1 2008 SP1 release of the suite. CHM version of the documentation is also available for download at this location.

    Regards,
    Stephen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Mario
    Mario avatar
    75 posts
    Member since:
    Jun 2009

    Posted 18 Jun 2009 Link to this post

    hello,

    im using the actual 2009 version of the radgrid but i still got that problem that i cant put objectinfo into my CommandArguments of my GridButtonColumn (ImageButton).

    I red the actual online help to the template column @ http://www.telerik.com/help/aspnet-ajax/grdgettingstarted.html ,but i couldnt choose a field of my dataset, maybe cause i do not allow automatic column generation, because i defined all my columns myself.

    So how get the via Linq's DAL Object Document.Metainformation.name via that code input ?! document is the table im selecting all on and metainformation is the next table where document got a foreign key from. there i have the name i want to use. so i can open a filepath via imagebutton.

    thx mario
  8. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 28 Oct 2010 Link to this post

    I got around this issue by encoding an image into the Text property of the telerik:GridHyperLinkColumn like so...

    <telerik:GridHyperLinkColumn
            Groupable="false"
            HeaderText="PDF"
            Text="<img src='../App_Themes/MyTheme/Images/SmallButtons/PDF-20x20.png' width='20' height='20' border='0' alt='' />"
            DataNavigateUrlFormatString="~/Info.aspx?id={0}"
            DataNavigateUrlFields="PDFLink"
            AllowFiltering="false" >
        <HeaderStyle HorizontalAlign="Center" Width="48px" />
        <ItemStyle HorizontalAlign="Center" Width="48px" />
    </telerik:GridHyperLinkColumn>
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017