To know if the childtable has some data.

1 reply. Last post: January 15, 2013 1:35 AM by Hans Kristian
Tags :
  • (None)

I need to know if the chiltable into webgrid has some data, In this possible to know that with visual studio code?

 

Thanks in advance.

All Replies

Hello,

Yes it is possible. Perhaps you could use GetChildRows() method to know whether the row have a child table or not.

Here’s the snippet example code how to use GetChildRows() method:

<script language="javascript" type="text/javascript">
    function expandChildRow() {
        var grid = ISGetObject("WebGrid1");
        var selObj = grid.GetSelectedObject();
            
        if (selObj == null) {
            alert("Please select a row");
            return;
        }
        else {
            var row = selObj.GetRowObject();
            if (!row.ChildExpanded) {
                    //Expand the child row                   
                    row.ExpandChildRow(true);
                    //Get child rows
                    var childRows = row.GetChildRows();
                        
                    //If the row have child rows
                    if (childRows)
                        alert("This row have child rows!");
                    //If the row doesn't have child rows
                    else
                        alert("This row doesn't have any child rows!");
            }
            else
                alert("Row already expanded!");
        }
    }
</script>

Hope this helps.

 

Thank you.

Regards,

Hans.

All times are GMT -5. The time now is 7:47 AM.
Previous Next