Hello
I have a RadGrid with a template column(imagebutton)
i want
when i click the imagebutton execute a code behind
but i need to know a column value for Example.: an email
how can i do that?
Thanks
P.S.
Sorry about my english is not good enough :)
I have a RadGrid with a template column(imagebutton)
i want
when i click the imagebutton execute a code behind
but i need to know a column value for Example.: an email
how can i do that?
Thanks
P.S.
Sorry about my english is not good enough :)
4 Answers, 1 is accepted
0
Hello Luis,
Try this approach:
Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Try this approach:
<telerik:GridTemplateColumn UniqueName="Test"> <ItemTemplate> <asp:ImageButton ID="ImageButton1" runat="server" OnClientClick="getValues(this)" ImageUrl="~/img.png" AlternateText="Button" /> </ItemTemplate></telerik:GridTemplateColumn><script type="text/javascript"> function getValues(sender) { var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView(); var columnIndex = masterTable.getColumnByUniqueName("myColumnName").get_element().cellIndex; var cell = sender.parentNode; var text = cell.parentNode.cells[columnIndex].innerHTML; alert(text); }</script>Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Luis
Top achievements
Rank 1
answered on 27 Nov 2009, 01:05 PM
Is ok
but i want to do this from VB or C#
but i want to do this from VB or C#
0
Accepted
Hello Luis,
Here is how to get the text of an adjacent cell in the same row:
Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Here is how to get the text of an adjacent cell in the same row:
<telerik:GridTemplateColumn UniqueName="Test"> <ItemTemplate> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/img.png" AlternateText="Button" OnClick="ImageButton1_Click" /> </ItemTemplate></telerik:GridTemplateColumn>protected void ImageButton1_Click(object sender, ImageClickEventArgs e){ GridDataItem item = (sender as ImageButton).NamingContainer as GridDataItem; RadAjaxPanel1.Alert(item["ColumnName"].Text);}Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Luis
Top achievements
Rank 1
answered on 27 Nov 2009, 05:23 PM
If you aren't the best you're one of them
thanks a lot
thanks a lot