Click on GridImageColumn does NOT fire RowClick() event

2 posts, 0 answers
  1. Randall
    Randall avatar
    55 posts
    Member since:
    Jun 2008

    Posted 12 Sep 2011 Link to this post


    Using RadControls for ASP.NET v2011.2.712.35

    I have a RadGrid with client-side row click event defined as follows:

    <telerik:RadGrid runat="server" ID="RadGrid_Combo" ... >
        <ClientSettings EnableRowHoverStyle="true">
        <MasterTableView TableLayout="Fixed">
                <telerik:GridImageColumn UniqueName="ImageUrl"
                    DataAlternateTextFormatString="{0} Object"
                    <HeaderStyle Width="25px" Wrap="false" />

    My Javascript is:

    <script type="text/javascript">
    function OP_RadGrid_RowSelected(sender, args)
        // do some stuff

    When I click on a row in the RadGrid, the OP_RadGrid_RowSelected() event fires just fine.

    However, when I click on the image in the GridImateColumn, the OP_RadGrid_RowSelected() event DOES NOT fire.

    How can I make the OP_RadGrid_RowSelected() fire when I click on the Image?

    Randall Price
    Senior Developer
    Virginia Tech
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Sep 2011 Link to this post

    Hello Randall,

    Give a try with the following code snippet to select the row when clicking on Image in grid row.

    protected void RadGrid_Combo(object sender, GridItemEventArgs e)
          if (e.Item is GridDataItem)
              GridDataItem Item = (GridDataItem)e.Item;
              Image btn = (Image)Item["ImageUrl"].Controls[0];
              btn.Attributes.Add("OnClick", "imgclick('"+Item.ItemIndex+"');");

    Java Script:
    <script type="text/javascript">
        function imgclick(index) {
                var masterTable = $find("<%=RadGridDocuments.ClientID%>").get_masterTableView();
                 masterTable.fireCommand("Select", index); //will select the row
        function RowSelected(sender, eventargs) {

Back to Top