Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
546
Urgent LoadOnDemand Problem
posted

Hi,

 

I'm using UWG 2008.2 (CLR 3.5) with the latest patch (.2.20082.2149).

The grid is set to LoadOnDemand="Xml" and the InitializeDataSource event is implemented.

Everything works fine and the grid loads additional date when scrolled down. The grid is inside an AJAX updatepanel. When the user selects a row and presses on a seperate edit button, I get the selected row from the grid and open a dialog in the buttons click event. This works just fine if the grid hasn't been scrolled down (hasn't been loading on demand). If the grid did load additional data the SelectedRows collection is always empty, eventhough a row was selected by the user.

I found out that the InitializeDataSource event is fired before the button click event. But the SelectedRows collection is already empty when InitializeDataSource is fired.

This is a huge problem for me and I urgently need a solution.

 

Thank you for your help.

 

 

Parents
No Data
Reply
  • 546
    Verified Answer
    posted

    As I still have this problem, and it also occurs when a filter is applied....I had to find a solution.

    Here it is:

    I'm using clientside events to store the ID of the selected row in a hidden field. In my case the ID is stored in the first cell of my data.

    You need to put these two functions in your page:

    <script language="javascript" type="text/javascript">

            function uwgGroups_CellClickHandler(gridName, cellId, button) {           
                var rowObj = igtbl_getRowById(cellId);
                if (rowObj != null) {
                    if (rowObj.getDataKey() == null) {
                        igtbl_cancelPostBack(rowObj.gridId)
                    }
                    else {                                    
                        var tf = document.getElementById('<%=txtSelID.ClientID%>');
                        tf.value = rowObj.getCell(0).getValue();
                    }
                }
            }

            function uwgGroups_RowSelectorClickHandler(gridName, rowId, button) {
                var rowObj = igtbl_getRowById(rowId);
                if (rowObj != null) {
                    if (rowObj.getDataKey() == null) {
                        igtbl_cancelPostBack(rowObj.gridId)
                    }
                    else {                                       
                        var tf = document.getElementById('<%=txtSelID.ClientID%>');
                        tf.value = rowObj.getCell(0).getValue();
                    }
                }
            }
       
        </script>

     

    Then you have to add the following field to your markup:

     

    <input id="txtSelID" type="hidden" value="" runat="server" />

     

    Finally you need to bind the two functions to the grid:

    <DisplayLayout>

             <ClientSideEvents CellClickHandler="uwgGroups_CellClickHandler"
                RowSelectorClickHandler="uwgGroups_RowSelectorClickHandler"/>

    </DisplayLayout>

    In your codebehind you can now access the selected ID by: txtSelID.Value

     

    Hope that's helpful for other people :)

     

Children
No Data