User Profile & Activity

Mladen Maras Member
Posted: September 16, 2010 8:14 AM

For my case, that can't work. On my button click function row is inserted in the database. That is why I use grid.SendCustomRequest(); and  WebGrid1_InitializePostBack event handler so that datasource is refreshed with new row.

Also, your approach to expanding is top to bottom. Your code gets first group and expands it, and then expands all the children. I want to expand only groups and subgroups that lead to the new row (the one that was inserted on button click).

However, I found another way.

On the server-side in InitializeRow event handler, I first detect positions of the coresponding groups and invoke function on the client-side with those group positions.

protected void WebGrid1_InitializeRow(object sender, RowEventArgs e)
        {
            if (e.Row.Type == ISNet.WebUI.WebGrid.RowType.Record)
            {
                if (e.Row.Table.IsRootTable)
                {
                    int? newSastanakID = ConvertSafeNullable.ToInt(Session["NoviSastanak"]);
                    if (newSastanakID.HasValue && e.Row.KeyValue.ToString() == newSastanakID.Value.ToString())
                    {
                        var rootRow = e.Row.GetRootRow();
                        bool found = false;
                        int rootLevel = 0;
                        int subLevel = 0;
                        int subsublevel = 0;
                        foreach (WebGridRow rr in rootRow.Children)
                        {
                            foreach (WebGridRow rr2 in rr.Children)
                            {
                                if (rr2.Cells[0].Text == e.Row.Parent.Cells[0].Text)
                                {
                                    rootLevel = rootRow.Position;
                                    subLevel = rr.Position;
                                    subsublevel = rr2.Position;
                                    found = true;
                                    break;
                                }
                            }
                            if (found)
                            {
                                break;
                            }
                        }
                        WebGrid1.ClientAction.InvokeScript("ExpandToRow", new ISNet.WebUI.FunctionParameter[] { new ISNet.WebUI.FunctionParameter(rootLevel.ToString(), "int"), new ISNet.WebUI.FunctionParameter(subLevel.ToString(), "int"), new ISNet.WebUI.FunctionParameter(subsublevel.ToString(), "int") });
                        Session["NoviSastanak"] = null;
                    }
                }
                
            }
}

The client-side function looks like this:

 function ExpandToRow(rootLevel, subLevel, subsubLevel) {
            var grid = ISGetObject("WebGrid1");
            var rootRow = grid.RootTable.GetRowByGroup(0, rootLevel);
            rootRow.ExpandGroupRow();
            var subRow = rootRow.GetGroupChildRows()[subLevel];
            subRow.ExpandGroupRow();
            subRow.GetGroupChildRows()[subsubLevel].ExpandGroupRow();
            return;
        }

This way, only the groups that row is member of, are expanded.

Posted: July 6, 2010 11:54 AM

I have attached simple web application with grid. Even with the latest hotfix it does not work.

Maybe, the problem is not with XHTML but the combination of VirtualLoad and Grouping.

I need to know how can I make grid do two things:

  1. When the group is expanded, rows should be fetched from server and rendered on client (now they are being fetched from server but are not rendered on the client)
  2. If the column has long caption, height of the grid header should increase in order so the caption can be shown completely.
Posted: March 12, 2010 5:35 AM

I set the property GroupByBoxVisible="True" in the example that I have previously uploaded and I still get the same exception.

The problem is this. When grid is loaded for the first time, there is no grouping and column Country is shown with other columns in the grid.

When "Add Group" is clicked, javascript function creates grouping and grid groups by the Country column.

When "Remove Group" is clicked, javascript function removes group and there are no more groups in the grid but the Country column is missing.

When "Add Group" is clicked again, "null or not an object" is thrown while calling grid.RootTable.UpdateUI(); in javascript function.

This is probably because column Country is missing from the Columns section of the grid. It was removed by the grid first time it was grouped by but it was not returned to it when it was removed from the GroupedColumns section.

How can this be solved?

Posted: March 12, 2010 3:58 AM

The error happens when grid.RootTable.UpdateUI(); is called. It happens when I add group by column that has been previously removed from the Group By columns.

I have attached an example for you. I have modified your Programmatic_UI2 example from the WebGridTutorial solution. Run it, click Add Group, then click Remove Group and again Add Group and you will get the same exception.

Posted: November 3, 2009 4:54 AM

I have found why System.OutOfMemory exception was thrown. In fact, when aspx page with grid tries to load for the first time, System.FileIOPermission is thrown.  After reloading, System.OutOfMemory exception is thrown.

Since our pages are embedded in Sharepoint 2007, I raised trust level to "Full". After that, webgrid loaded without problem.

In the prior version (2009 R1, not 2009 R1 SP1), WebUI controls worked under "WSS_Medium". Because of our client security policy, trust level should stay "WSS_Medium".

 

How can this issue be solved?

Posted: November 2, 2009 12:11 PM

Hi, Handy.

I have uninstalled WebUI Studio and removed all assemblies from GAC. I have then downloaded and installed latest WebUI Studio release (posted date 2009-10-26).

Licence manager, deployment manager and update manager all work fine. WebGrid Designer in Visual Studio also works.

Our project now compiles in VS .Net, but when you access deployed aspx pages it throws System.OutOfMemory exception. 

I have checked & rechecked web.config and assembly versions are OK. On the other side, I have published your WebGrid Samples and they work without a problem.

Our custom aspx pages are embedded in the Sharepoint 2007.

I have attached screenshot with list of assemblies that were added to GAC during installation process. In the prior version of Web UI Studio (R1 not SP1), it seems to me there were more of them. Is this normal?

 

Posted: September 18, 2009 4:47 AM

Thank you for your answer.

Maybe I was little vague with issue #1. The data in the column represents phases and may consist of 3 parts (major, medium and minor phase).

For example:

01

01.20

01.100.03

...

100

100.40

100.40.120

In database data is saved as varchar(20), in dataset DataType is string and the corresponding WebGridColumn has also DataType string.

Everything is working fine in WebGrid, it can be sorted, grouped and filtered. It seems that Excel automatically recognizes numbers in the column and converts them from string. The issue won't happen when there are multiple phases in the cell divided with comma like (01.20.01, 01.20.30).

Regarding issue #2, if <br> tag solves the newline issue, does it mean that other "special" characters like ampersand should also be replaced with equivalent html tags?

In what event handler does this need to be done (InitalizeDataSource, InitializeRow or Export)?

All times are GMT -5. The time now is 4:15 PM.
Previous Next