This is a migrated thread and some comments may be shown as answers.

How to use Redirection using ImageButtonColumn

1 Answer 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 12 May 2012, 11:09 PM
i tried to make a direct using an ImageButtonColumn but i was unable to put it together using this link.  http://www.telerik.com/community/forums/aspnet-ajax/grid/select-row-through-telerik-linkbutton-and-redirect.aspx

How would I make a redirect using the imagebuttoncolumn?

The code i'm using is below:

                        <telerik:GridButtonColumn DataType="System.String" FooterText="Vallet" DataTextFormatString="Vallet {0}"
                        ButtonType="ImageButton" UniqueName="valletimagebutton" HeaderText="Vallet" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
                        CommandName="CarLot_RadGrid_Redirect" DataTextField="VIN" ImageUrl="images/valletcarlot.jpg">
                    </telerik:GridButtonColumn>.

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 13 May 2012, 05:58 AM
Hello Joshua,

<script type="text/javascript">
          function rediredtpage(url) {
 
              window.location = url;
              return false;
 
          }
           
      </script>
<telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="valletimagebutton"
                        HeaderText="Vallet" DataTextField="Name" ImageUrl="images/valletcarlot.jpg">
protected void rgdListLicences_ItemDataBound(object sender, GridItemEventArgs e)
       {
           if (e.Item is GridDataItem)
           {
               GridDataItem item = e.Item as GridDataItem;
            
               ImageButton ibtn = item["valletimagebutton"].Controls[0] as ImageButton;
               string strurl = "http://www.google.com";
               ibtn.Attributes.Add("onclick", "return rediredtpage('" + strurl + "');");


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Joshua
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or