Results 1 to 3 of 3

Thread: absolutely no way on earth to ger radgridview object.

  1. #1

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,605

    absolutely no way on earth to ger radgridview object.

    Hi.
    I can only get the radgridview by var grid = $('[id$=RadGridToInvoice]'); but this will create an object, object that I have no idea what todo with (probably tabled)

    Code:
    
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentContent" Runat="Server">
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
     <script type="text/javascript">
     function radb1cliecntclick(sender, args) {
                    var text1 = $find('<%= RadTextBoxInvoice.ClientID %>');                 
                    
                    if (isEmpty(text1.get_textBoxValue()))
                    {
                     //   alert(lbl1);
                    }               
                    
                   // args.set_cancel(true);
                }
    
    
                function isEmpty(str) {
                    return (!str || 0 === str.length);
                }
    
      function rgtodrop(sender, eventArgs) {
    
               //       var radGrid = $find("<%= tbl1.FindControl("RadGridToInvoice").ClientID %>");
               //     alert(radGrid);
               //  var grid = $find("<%= RadGridToInvoice.ClientID %>");
                    //alert(grid);
                //    var grid = $find("<%= RadGridToInvoice.ClientID %>"); 
                 //   alert(grid);
                  //  var grid = $('[id$=RadGridToInvoice]');
                  //  var MasterTable = value.get_masterTableView();
                  //  alert(MasterTable);
                //    var rowCount = grid.get_masterTableView().get_dataItems().length;
                //    alert(rowCount);
                 //  var MasterTable = radto.get_masterTableView();
                 //  var Rows = MasterTable.get_dataItems();
                 //  alert(Rows.length);
                }
    
                //dropped to toinvoice grid
                function rgpendrop(sender, eventArgs) {
              //      var radGrid = $find("<%= tbl1.FindControl("RadGridToInvoice").ClientID %>");
               //     alert(radGrid);
    
                //       var grid = $find("<%= RadGridToInvoice.ClientID %>");
                  //  alert(grid);
                 //   var items = ($find(RadGridToInvoice).get_masterTableView().get_dataItems());
                  //  alert(items);
                  //     var grid1 = $find("<%= RadGridToInvoice.ClientID %>"); 
                //    alert(grid1);
                   
                 //   var grid = $('[id$=RadGridToInvoice]');
                  //  var MasterTable = value.get_masterTableView();
                    //  alert(MasterTable);
                  //  var rowCount = grid.get_masterTableView().get_dataItems().length;
                  //  alert(rowCount);
                  //  var radto1 = $telerik.findControl(document, "RadGridToInvoice");
                  //  var MasterTable = radto1.get_masterTableView();
                  //  var Rows = MasterTable.get_dataItems();
                  //  alert(Rows.length);
                }
    
            </script>
        </telerik:RadCodeBlock>
     <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
            
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxManager runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">        
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGridPending">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGridPending" />
                           <telerik:AjaxUpdatedControl ControlID="RadGridToInvoice" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                 <telerik:AjaxSetting AjaxControlID="RadGridToInvoice">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGridToInvoice"  />
                           <telerik:AjaxUpdatedControl ControlID="RadGridPending" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="RadButton1">                    
                    <UpdatedControls>                    
                        <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1"   />
                        <telerik:AjaxUpdatedControl ControlID="RadGridToInvoice"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>     
            </AjaxSettings>
        </telerik:RadAjaxManager>
    
     <table style="width:100%" id="tbl1" runat="server">
            <tr>
                <td style="border: thin inset #808080; width:48%; font-size: large; font-weight: bold; background-color: #C0C0C0; vertical-align: middle; text-align: center;">
                    Pending Measurements
                </td>
                <td style="width:4%"></td>
                <td style="border: thin inset #808080; width:48%; font-size: large; font-weight: bold; background-color: #C0C0C0; vertical-align: middle; text-align: center;">
                    Measurements To Invoice
                </td>
            </tr>
            <tr>
               
                <td>
                    <telerik:RadGrid ID="RadGridPending" runat="server" Skin="Simple" width="100%"  
                        AllowFilteringByColumn="False" AllowSorting="False" AutoGenerateColumns="False" ShowFooter="true"
                        OnNeedDataSource="RadGridPending_NeedDataSource" OnRowDrop="RadGridPending_RowDrop">
                        <ClientSettings AllowRowsDragDrop="True" AllowColumnsReorder="true" ReorderColumnsOnClient="true">
                            <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"></Selecting>
                            <ClientEvents OnRowDropping="demo.onRowDropping" OnRowCreated="rgpendrop"></ClientEvents>
                            <Scrolling AllowScroll="true" UseStaticHeaders="true"></Scrolling>
                        </ClientSettings>
                        <MasterTableView DataKeyNames="CountID">
                            <columns>
                                <telerik:GridDragDropColumn HeaderStyle-Width="18px" Visible="true">                                 
                                </telerik:GridDragDropColumn>
                                <telerik:GridBoundColumn DataField="DateTo" UniqueName="DateTo" HeaderText="Date" ReadOnly="true" DataFormatString="{0:dd/MM/yyy}">
                                    <HeaderStyle HorizontalAlign="Center" Wrap="False"  Width="110px"/>
                                    <ItemStyle HorizontalAlign="Center" Wrap="False" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="CinemaShortName" UniqueName="CinemaShortName" HeaderText="Cinema" ReadOnly="true">
                                    <HeaderStyle HorizontalAlign="Left" Wrap="False"  Width="110px"/>
                                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="PartnerName" UniqueName="PartnerName" HeaderText="Partner" ReadOnly="true">
                                    <HeaderStyle HorizontalAlign="Left" Wrap="False"  Width="110px"/>
                                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="AreaDescription" UniqueName="AreaDescription" HeaderText="Area" ReadOnly="true">
                                    <HeaderStyle HorizontalAlign="Left" Wrap="False"  Width="110px"/>
                                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                                </telerik:GridBoundColumn>
    
                                 <telerik:GridBoundColumn DataField="CinemaCode" UniqueName="CinemaCode" HeaderText="CinemaCode" ReadOnly="true" Visible="true" HeaderStyle-Width="0px">
                                     </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="commissionID" UniqueName="commissionID" HeaderText="commissionID" ReadOnly="true" Visible="true" HeaderStyle-Width="0px">
                                     </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="AreaID" UniqueName="AreaID" HeaderText="AreaID" ReadOnly="true" Visible="true" HeaderStyle-Width="0px">
                                     </telerik:GridBoundColumn>
    
                                <telerik:GridBoundColumn DataField="GrossRevenue" UniqueName="GrossRevenue" HeaderText="GrossRevenue" ReadOnly="true" DataFormatString="{0:c}" Aggregate="Sum">
                                    <HeaderStyle HorizontalAlign="Right" Wrap="False"  Width="110px"/>
                                    <ItemStyle HorizontalAlign="Right" Wrap="False" />
                                    <FooterStyle HorizontalAlign="Right" Wrap="False" />
                                </telerik:GridBoundColumn>
                            </columns>
                        </MasterTableView>
                    </telerik:RadGrid>
                </td>
                <td></td>
                <td>
                    <telerik:RadGrid ID="RadGridToInvoice" runat="server" Skin="Simple" Width="100%" 
                        AllowFilteringByColumn="False" AllowSorting="False" AutoGenerateColumns="False" ShowFooter="true"
                         OnNeedDataSource="RadGridToInvoice_NeedDataSource"
                        OnRowDrop="RadGridToInvoice_RowDrop" >
                        <ClientSettings AllowRowsDragDrop="True">
                            <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"></Selecting>
                            <ClientEvents OnRowDropping="demo.onRowDropping" OnGridCreated="demo.onGridCreated"  OnRowCreated ="rgtodrop"></ClientEvents>
                              <Scrolling AllowScroll="true" UseStaticHeaders="True"></Scrolling>
                        </ClientSettings>
                        
                        <MasterTableView DataKeyNames="CountID" NoMasterRecordsText="Drag-Drop Invoices from Pending Measurements">
                            <columns>
                                <telerik:GridDragDropColumn HeaderStyle-Width="18px" Visible="True">
                                </telerik:GridDragDropColumn>
                                <telerik:GridBoundColumn DataField="DateTo" UniqueName="DateTo" HeaderText="Date" ReadOnly="true" DataFormatString="{0:dd/MM/yyy}">
                                    <HeaderStyle HorizontalAlign="Center" Wrap="False"  Width="110px"/>
                                    <ItemStyle HorizontalAlign="Center" Wrap="False" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="CinemaShortName" UniqueName="CinemaShortName" HeaderText="Cinema" ReadOnly="true">
                                    <HeaderStyle HorizontalAlign="Left" Wrap="False"  Width="110px"/>
                                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="PartnerName" UniqueName="PartnerName" HeaderText="Partner" ReadOnly="true">
                                    <HeaderStyle HorizontalAlign="Left" Wrap="False"  Width="110px"/>
                                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="AreaDescription" UniqueName="AreaDescription" HeaderText="Area" ReadOnly="true">
                                    <HeaderStyle HorizontalAlign="Left" Wrap="False"  Width="110px"/>
                                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                                </telerik:GridBoundColumn>
    
                                 <telerik:GridBoundColumn DataField="CinemaCode" UniqueName="CinemaCode" HeaderText="CinemaCode" ReadOnly="true" Visible="true" HeaderStyle-Width="0px">
                                     </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="commissionID" UniqueName="commissionID" HeaderText="commissionID" ReadOnly="true" Visible="true" HeaderStyle-Width="0px">
                                     </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="AreaID" UniqueName="AreaID" HeaderText="AreaID" ReadOnly="true" Visible="true" HeaderStyle-Width="0px">
                                     </telerik:GridBoundColumn>
    
                                <telerik:GridBoundColumn DataField="GrossRevenue" UniqueName="GrossRevenue" HeaderText="GrossRevenue" ReadOnly="true" DataFormatString="{0:c}" Aggregate="Sum">
                                   <HeaderStyle HorizontalAlign="Right" Wrap="False"  Width="110px"/>
                                    <ItemStyle HorizontalAlign="Right" Wrap="False" />
                                    <FooterStyle HorizontalAlign="Right" Wrap="False" />
                                </telerik:GridBoundColumn>
                            </columns>
                        </MasterTableView>
                    </telerik:RadGrid>
                </td>
            </tr>
            <tr>
                <td></td>
                <td></td>
                <td>
                <!--    Total Gross Value: -->
                </td>
            </tr>
        </table>
    I've left all my test but var grid = $find("<%= RadGridToInvoice.ClientID %>"); will return null.

    Any help?
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: absolutely no way on earth to ger radgridview object.

    I've not worked with radgrid...

    When I work with SlickGrid's I create a global variable and hold onto that grid object forever so I can work with it down the line.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,605

    Re: absolutely no way on earth to ger radgridview object.

    What I found out is that I can get the grid on it's client event (through sender) but not from event fire from other controls.
    I'm not sure I can initially get the grid on page load but I guess I can get it on grid created or something similar.
    Of course the issue here is if the global object will update with any changes on new rows. Can't say that I have ever tried something like that.
    Anywho, I used server side code for now but I'll give it a try after eastern.
    thanks
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width