Grid Postback only on master table rows

2 posts, 0 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 11 Nov 2010 Link to this post

    Hello,

    I have a master/detail table.  I want to enable postback on row click, but only for master table rows.  How can I make that happen?  I saw articles on using __doPostBack('<%= rg1.ClientID');, but I want it to fire the ItemCommand event.  Is there a way to wire that up to make it work on client row click?  Add a RowClick$<index> parameter, or something?

    Or is there another setting?

    Thanks.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 12 Nov 2010 Link to this post

    Hello Brian,

    Try the following approach to achieve your requirement. Attach OnRowClick client event to RadGrid. Inside that event handler check for the GridTableView name and if it is masterTable, then  perform the postback request using __doPostBack("<%= RadGrid1.UniqueID %>". And process the postback in the code-behind of the page using the RaisePostBackEventHandler instead of ItemCommand event.

    Java Script:
    <script type="text/javascript">
        function RowClick(sender, args) {
              var dataItem = args.get_gridDataItem();
              if (dataItem.get_owner().get_name() == "Master"){ // check woth the name of GridTableView
            }
    </script>

    Please go through the following KB article for more information on performing postback from grid client events.

    Performing postback from grid client events


    Hope this helps,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top