User Profile & Activity

Hans Kristian Member
Page
of 69
Posted: July 21, 2014 3:49 AM

Hello,

I apologize for the late response.

Basically, we can’t use “Load on Demand” scenario or feature in (TreeView) node that already has children (child node).

I attached a page that contains ASP.Net TreeView to show how the “Load on Demand” feature of ASP.Net TreeView works.

In this page, I add “OnTreeNodePopulate” server side event to the TreeView control.

On the “Page_Load” server side event, I create the root node for the TreeView:

protected void Page_Load(object sender, EventArgs e){
    if (!IsPostBack)
    {
        TreeNode rootNode = new TreeNode();
        rootNode.Text = "Root";
        rootNode.Value = "Level0";
        rootNode.Expanded = true;
        rootNode.PopulateOnDemand = true;

        TreeView1.Nodes.Add(rootNode);
    }
}

Then in “OnTreeNodePopulate” server side event I try to add two nodes with different depth level.

protected void TreeView1_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
    TreeNode newNode = new TreeNode();
    newNode.Text = "Level One";
    newNode.Value = "Level1";
    newNode.PopulateOnDemand = false;

    TreeNode newNode2 = new TreeNode();
    newNode2.Text = "Level Two";
    newNode2.Value = "Level2";
    newNode2.PopulateOnDemand = true;

    newNode.ChildNodes.Add(newNode2);
    e.Node.ChildNodes.Add(newNode);
}

With this configuration the ASP.Net TreeView will work properly. However, if you try to modify the “PopulateOnDemand” property, in “newNode”, to “True”.
You will get the warning message while you are trying to expand the root node.

I attached the video regarding the result on my end as well.

As you can see, the Intersoft WebTreeView have the same default behavior with ASP.Net TreeView, that the “Load on Demand” scenario or feature can’t be applied in (TreeView) node that already has children (child node).

Due to that behavior, in this Load on Demand scenario, the WebTreeView will only load the parent node, not with its child node.

Hope this helps.

Regards,
Hans K.

Posted: July 20, 2014 10:46 PM
Hello,

Thank you for the question.

Generally, export feature is capable for exporting two types of grid's data, one is the root table and the other is selected child table's data.

The export for root table will not export any hierarchical data because of performance issues and based on common requirements.

The export for selected child table will export the entire data for the selected child table and not including any hierarchical data.

Yes, it is possible to filter child rows when using default Filter.

Regards,
Hans K.

Hello,

I’m glad to hear that the JavaScript code suitable for your current scenario.

Should you have further question, please do not hesitate to contact us.

Thank you.

Regards,
Hans K.

Hello,

Please forgive me for lack of understanding about the reported problem.

I modified the JavaScript code by adding code to handle Left and Right key event.

I add a new function that suitable with Left and Right key event:

function activateEditModeColumn(grid, curCellIndex, nextCellIndex, curRowIndex){
    if (nextCellIndex >= 0 && nextCellIndex < grid.RootTable.Columns.length)
    {
        var curRowEl = grid.RootTable.GetRow(curRowIndex);
        var currCell = curRowEl.GetCell(curCellIndex);
        var nextCell = curRowEl.GetCell(nextCellIndex);
        grid.SetFocus();
        currCell.Select(true);
        curRowEl.Select();
        nextCell.ActivateEdit();
    }
}

I add a couple of line codes in WebGrid1_OnEditKeyDown function:

//if left arrow key
else if (event.keyCode == 37) {
    grid.ExitEdit(1, 0, 0); 

    intervalObj = setInterval(function ()
    {
        if (!grid.IsInProgress)
        {
            activateEditModeColumn(grid, curCell - 1, curCell - 2, curRowIndex);
            clearInterval(intervalObj);
            intervalObj = null;
        }
    }, 5);
}

//if right arrow key
else if (event.keyCode == 39) {
    grid.ExitEdit(1, 0, 0); 

    intervalObj = setInterval(function ()
    {
        if (!grid.IsInProgress)
        {
            activateEditModeColumn(grid, curCell - 1, curCell, curRowIndex);
            clearInterval(intervalObj);
            intervalObj = null;
        }
    }, 5);
}

I attached the modified page as well. Please kindly have review on the page once again.

Thank you.

Regards,
Hans K.

Hello,

Exporting is not supported when binding mode is set to either WCF, WebService or Astoria. It is due to the datasource is handled externally from other external source, then return the data to Client-side directly to be processed. As for exporting, the data source needs to be on the Server-side in order to export the data and perform additional Server-side binding and processing.

Please have review on the documentation for further information.

Thank you.

Regards,
Hans K.
Posted: July 16, 2014 2:52 AM
Hello,

I’m glad to hear that you have resolved the issue with this work around.

Should you have further question, please do not hesitate to contact us.

Thank you.

Regards,
Hans K.

Hello,

I made a WebGrid page that perhaps similar with your current scenario.

I add JavaScript code that handle Key Up and Key Down event while in edit mode in WebGrid.

If we press Key Up/Down while in editing mode, the cursor will be focus on the next/previous row.

Here’s the JavaScript code:
var intervalObj;
function activateEditMode(grid, curRowIndex, nextRowIndex, columnName, cell) {
    if (nextRowIndex >= 0 && nextRowIndex < grid.TotalRows) {
        var nextRowEl = grid.RootTable.GetRow(nextRowIndex);
        var curRowEl = grid.RootTable.GetRow(curRowIndex);
        var cell1 = nextRowEl.GetCell(cell);
        var cell2 = curRowEl.GetCell(cell);
        grid.SetFocus();
        cell2.Select(true);
        nextRowEl.Select();
        cell1.ActivateEdit();
    }
}

function WebGrid1_OnEditKeyDown(controlId, keyCode)
{
    // get the grid
    var grid = ISGetObject(controlId);
    // get current information about row and cell
    var activeEditCell = grid.GetActiveEditCell();
    var columnName = wgGetColNameByCell(activeEditCell.element);
    var curRow = activeEditCell.rowElement;
    var curRowIndex = curRow.rowIndex;
    var curCell = grid.GetActiveEditCell().cellIndex;


    if (keyCode == 38) { // if up arrow
        grid.ExitEdit(1, 0, 0);  // exit and update the row if dirty
                
        intervalObj = setInterval(function ()
        {
            if (!grid.IsInProgress)
            {
                activateEditMode(grid, curRowIndex, curRowIndex - 1, columnName, curCell - 1);
                clearInterval(intervalObj);
                intervalObj = null;
            }
        }, 5);

    }
            
    else if (keyCode == 40) {  // if down arrow or enter key
        grid.ExitEdit(1, 0, 0);  // exit and update the row if dirty

        intervalObj = setInterval(function ()
        {
            if (!grid.IsInProgress)
            {
                activateEditMode(grid, curRowIndex, curRowIndex + 1, columnName, curCell - 1);
                clearInterval(intervalObj);
                intervalObj = null;
            }
        }, 5);
    }
    return true;
}

I attached the page & video regarding this scenario. Please kindly have review on the attached file and let me know your response.

Regards,
Hans K.

Hello,

I apologize, currently WebGrid doesn’t have any feature to export child table in SelfReferencing mode.

I will forward this to the developer team to consider this as a feature request.

Thank you.

Regards,
Hans K.
Hello,

I try to modify one of WebGrid Samples Solution, HierarchicalGrid.aspx page, by adding a couple of buttons to export WebGrid data.

Here’s snippet example code how to export the root table:
function ExportRootTable() {    var WebGrid1 = ISGetObject("WebGrid1");

    //export grid data to Microsoft Excel
    WebGrid1.ExportGrid("Customers", "EXCEL", "PORTRAIT");
            
    return true;
}

Here’s snippet example code how to export the child table:

function ExportSelectedChildTable_Orders() {
    var WebGrid1 = ISGetObject("WebGrid1");

    //export grid data to Microsoft Excel
    WebGrid1.ExportGrid("Orders", "EXCEL", "PORTRAIT", WebGrid1.GetSelectedObject().ToRowObject().GetParentRow().RowElement);

    return true;
}

I attached the page that show how implement the JavaScript code.
Please try to add the page to the WebGrid Samples Solution to see the result.

Regards,
Hans K.

Hello,

Basically, this printing scenario (code for printing) is beyond Intersoft control itself.
However, I will try to help you to find a work around for this printing scenario.

I try to modify one of WebGrid Samples, EnableExporting.aspx page.
In this page, I add OnExport server side event in the WebGrid and then I add a line of code to set the ReportName property.
Here’s the example code:

protected void WebGrid1_Export(object sender, ISNet.WebUI.WebGrid.ExportEventArgs e){
    e.ReportInfo.ReportName = "EnableExportingPage";
}

Next, I add OnAfterResponseProcess client side event to handle the printing scenario.
Here’s the code:

function printWindow() {
    var printWin = window.open("./TempReports/EnableExportingPage.html");
            
    if (printWin == null) {
        setTimeout(printWindow(), 500);
    }
    else {
        printWin.print();
        printWin.close();
    }
}

function WebGrid1_OnAfterResponseProcess(gridId, action, lastRequestObject, xmlResponseObject) {
    if (action == "Export") {
        printWindow();
    }
}


I attached the modify EnableExporting.aspx page as well. Please kindly add the page to the WebGrid Solution Samples, to see the result.

Thank you.

Regards,
Hans K.

All times are GMT -5. The time now is 12:53 AM.
Previous Next