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

[Solved] GridButtonColumn with link and parameters

2 Answers 202 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alex Jimenez
Top achievements
Rank 1
Alex Jimenez asked on 03 Feb 2010, 01:30 PM
Hi,

I'm working with the telerik:RadGrid. I need a column working as a GridHyperLinkColumn but with an image.
I try with asp:ImageButton but I don't know how indicate the parameters.

In example :

Using HyperLinkColumn with parameter ORDN40 in the DataNavigateUrlFormatString : 

<

 

telerik:GridHyperLinkColumn DataTextFormatString="Detalle" DataNavigateUrlFields="ORDN40"

 

 

UniqueName="detalleP" DataNavigateUrlFormatString="pedidos_detalle.aspx?p={0}"

 

 

DataTextField="ORDN40" AllowFiltering="False" Groupable="False">

 

 

<HeaderStyle Height="40px" />

 

 

</telerik:GridHyperLinkColumn>

 


Using ImageButton  I don' know how to pass the parameter ORDN40.

<

 

telerik:GridTemplateColumn UniqueName="ExternalLink" AllowFiltering="False" Groupable="False">

 

 

<ItemTemplate>

 

 

<asp:ImageButton ID="ImageButton1" runat="server" PostBackUrl="pedidos_detalle.aspx?p={0}"

 

 

ImageUrl="img/info.jpg" />

 

 

</ItemTemplate>

 

 

<HeaderStyle Height="40px" />

 

 

</telerik:GridTemplateColumn>

 


Thanks A lot!

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Feb 2010, 08:33 AM
Hi,

Try the syntax to pass the parameter to the PostBackUrl of the ImageButton:

ASPX:
    <telerik:GridTemplateColumn UniqueName="MenuDispaly"
           <ItemTemplate> 
                <asp:ImageButton ID="ImageButton1" ImageUrl="~/Images/Water lilies.jpg"  PostBackUrl='<%# string.Format("WebForm2.aspx?Key={0}",DataBinder.Eval(Container,"DataItem.CustomerID"))%>' runat="server" /> 


Thanks,
Princy
0
Alex Jimenez
Top achievements
Rank 1
answered on 12 Feb 2010, 12:11 PM
THANKS!

WORK IT PERFECT!!

Tags
Grid
Asked by
Alex Jimenez
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Alex Jimenez
Top achievements
Rank 1
Share this question
or