Opening a record when clicking on an columns of that record

6 posts, 0 answers
  1. Ashvin
    Ashvin avatar
    6 posts
    Member since:
    Oct 2007

    Posted 01 Aug 2008 Link to this post

    Hi Telerik Team,

    I have a grid with all Bound Columns in it. I want to open a record on a mouse click of any columns of that record. How do I do that?

    Regards
    Ashvin
  2. Sean
    Sean  avatar
    54 posts
    Member since:
    Apr 2008

    Posted 01 Aug 2008 Link to this post

    I would do it using the ClientSettings-ClientEvents-OnRowClick event, like:

    <
    script>
    function RowClick(sender, eventArgs) {
    alert(
    "Click on row: " + eventArgs.get_itemIndexHierarchical());
    eventArgs.set_cancel(true);
    }

    </script>

    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" AllowSorting="True"BorderStyle="None" Skin="Telerik" GridLines="None" OnNeedDataSource="radData_NeedDataSource">
    <MasterTableView>
    <RowIndicatorColumn Visible="False">
    <HeaderStyle Width="20px"></HeaderStyle>
    </RowIndicatorColumn>
    <ExpandCollapseColumn Visible="False" Resizable="False">
    <HeaderStyle Width="20px"></HeaderStyle>
    </ExpandCollapseColumn>
    <HeaderStyle HorizontalAlign="Center" />
    <Columns>
    <telerik:GridTemplateColumn ItemStyle-Width="150px" HeaderStyle-Width="150px" HeaderText="Name" UniqueName="Name" SortExpression="EntityName">
    <ItemTemplate>
    <!-- SOME CONTENT -->
    </ItemTemplate>
    <HeaderStyle Width="150px"></HeaderStyle>
    <ItemStyle Width="150px"></ItemStyle>
    </telerik:GridTemplateColumn>
    </Columns>
    </MasterTableView>
    <ClientSettings EnableRowHoverStyle="true">
    <Selecting AllowRowSelect="true" />
    <ClientEvents OnRowClick="RowClick"/>
    </ClientSettings>
    </telerik:RadGrid>

    Sean~

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Evgeny
    Evgeny avatar
    17 posts
    Member since:
    Jun 2008

    Posted 21 Nov 2008 Link to this post

    Hi,

    It seems like OnRowClick is not a cancellable event anymore, at least in Q3 release. trying to call aventArgs.set_cancel(true) raises JS error "Object doesn't support this property or method", while OnRowSelecting and other cancellable events work properly. Am I doing something wrong?

    If I'm correct, how can I cancel firing the event ItemCommand on server side, having a combination of 

    EnablePostBackOnRowClick

     

    ="True" in RadGrid client settings, and any client-side event on the grid?

  5. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 24 Nov 2008 Link to this post

    Hi Evgeny,

    You can use the rowClick to open a new window to the new location, or the details on that record. A similar approach is shown in the following example.
    I hope this helps.

    All the best,
    Yavor
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Evgeny
    Evgeny avatar
    17 posts
    Member since:
    Jun 2008

    Posted 24 Nov 2008 Link to this post

    Hi,

    Thanks for the example, but actually it's not what I need.

    I have grid without editing capabilities (i.e. no edit/delete buttons inside the grid). When user clicks on a row, I need to show confirmation dialog and then let it perform callback to the server side or not depending on user's choice.

    For now, I implemented it using OnRowSelecting on client and standard javascript cofirmation dialog, it works but this is not exactly what I need. An ideal way for me would be still having cancellable OnRowClick event (just like it is described in all your documentation and forum answers on similar questions), or any possible workaround simulating such behaviour. Also no page refreshes possible - only Ajax calls. Any ideas?

    As an outstanding question - I can't understand why you changed this approach and made OnRowCLick not cancellable?
  7. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 26 Nov 2008 Link to this post

    Hi Evgeny,

    The approach is achievable in the following manner - when clicking on the row, you can use a RadConfirm. The RadConfirm will return a result, depending on the user's choice - true or false. Then, depending on the result, you can either take no action, or make a callBack (AjaxRequest) to the server. Hence, you do not need to cancel the client side event.
    I hope this suggestion helps.

    Greetings,
    Yavor
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017