User Profile & Activity

Michael Giger Member
Page
of 8

Hi Glenn

I use default sample from SP1 and I have also tested with your attached sample, but it does not work unfortunately.

I am quite sure that I use the current dll, because I use the following new scenario:

WebGrid now supports various foreign column name in child and parent table when Hierarchical feature is enabled.

What could be the problem?

Regards

Michael

I had the problem earlier and was already in contact with Glenn.
Now I've just seen that Glenn has written back to me again (My Supports - IS-C554F370-167F-4097-9B9E-10502BBF3264 - last post). He told me that this is a bug.
However, I have not heard anything since then.
 
Regards
Michael

Hi Handy

I have installed SP1, but it doesn't work in my development environment.

Operating System Windows 2008 Server

Dev Environment: Microsoft Visual Studio.NET 2008

.NET Version: .NET Framework 3.5

I solved it! Very easy when you know it...
The following code was necessary.

UnitID.ValueList.DataSource = ds;

Importent:

The code must also be executed on postback!

I set cellstyle programmatically in PrepareDataBinding Event.

I suspect the column losts HorizontalAlign because it is coded in Page.IsPostBack .

protected void grd_PrepareDataBinding(object sender, DataSourceEventArgs e)
{
    if (!Page.IsPostBack)
    {
        WebGridColumn eID = grd.RootTable.Columns[0];
        eID.Caption = "ID";
        eID.Width = Unit.Pixel(250);
        eID.EditType = EditType.NoEdit;
        eID.Visible = QS.Roles.isQSAdmin;
        eID.IsAutoIncrement = true;

        WebGridColumn eName = grd.RootTable.Columns[1];
        eName.Caption = "Bezeichnung";
        eName.Width = Unit.Pixel(500);

        WebGridColumn eHide = grd.RootTable.Columns[2];
        eHide.Caption = "Ausblenden";
        eHide.Width = Unit.Pixel(80);
        eHide.CellStyle.HorizontalAlign = ISNet.WebUI.HorizontalAlign.Center;
        eHide.ColumnType = ColumnType.CheckBox;
        eHide.EditType = EditType.Checkbox;

        WebGridColumn eManuallyErrorDependencies = grd.RootTable.Columns[3];
        eManuallyErrorDependencies.Caption = "MED";
        eManuallyErrorDependencies.Width = Unit.Pixel(50);
        eManuallyErrorDependencies.EditType = EditType.NoEdit;
        eManuallyErrorDependencies.DefaultValue = "0";
        eManuallyErrorDependencies.Visible = QS.Roles.isQSAdmin;

        WebGridColumn eDependencies = new WebGridColumn("Dependencies", "Ref");
        eDependencies.ColumnType = ColumnType.Text;
        eDependencies.EditType = EditType.NoEdit;
        eDependencies.Width = Unit.Pixel(30);
        eDependencies.NewRowEditType = NewRowEditType.NoEdit;
        eDependencies.CellStyle.HorizontalAlign = ISNet.WebUI.HorizontalAlign.Center;
        eDependencies.CellStyle.VerticalAlign = ISNet.WebUI.VerticalAlign.Middle;
        grd.RootTable.Columns.Insert(0, eDependencies);
    }
}

 So I have change Code to this: 

protected void grd_PrepareDataBinding(object sender, DataSourceEventArgs e)
{
    if (!Page.IsPostBack)
    {
        grd.ClearCachedDataSource();
        grd.RetrieveHierarchicalStructure();

        lblTitle.Text = "Fehlerliste";
        imgTitle.ImageUrl = "~/Image/Icon/24/document_error.png";

        WebGridColumn eRef = new WebGridColumn("Dependencies", "Ref");
        grd.RootTable.Columns.Insert(0, eRef);
    }

    WebGridColumn eDependencies = grd.RootTable.Columns[0];
    eDependencies.ColumnType = ColumnType.Text;
    eDependencies.EditType = EditType.NoEdit;
    eDependencies.Width = Unit.Pixel(30);
    eDependencies.NewRowEditType = NewRowEditType.NoEdit;
    eDependencies.CellStyle.HorizontalAlign = ISNet.WebUI.HorizontalAlign.Center;
    eDependencies.CellStyle.VerticalAlign = ISNet.WebUI.VerticalAlign.Middle;

    WebGridColumn eID = grd.RootTable.Columns[1];
    eID.Caption = "ID";
    eID.Width = Unit.Pixel(250);
    eID.EditType = EditType.NoEdit;
    eID.Visible = QS.Roles.isQSAdmin;
    eID.IsAutoIncrement = true;

    WebGridColumn eName = grd.RootTable.Columns[2];
    eName.Caption = "Bezeichnung";
    eName.Width = Unit.Pixel(500);

    WebGridColumn eHide = grd.RootTable.Columns[3];
    eHide.Caption = "Ausblenden";
    eHide.Width = Unit.Pixel(80);
    eHide.CellStyle.HorizontalAlign = ISNet.WebUI.HorizontalAlign.Center;
    eHide.ColumnType = ColumnType.CheckBox;
    eHide.EditType = EditType.Checkbox;

    WebGridColumn eManuallyErrorDependencies = grd.RootTable.Columns[4];
    eManuallyErrorDependencies.Caption = "MED";
    eManuallyErrorDependencies.Width = Unit.Pixel(50);
    eManuallyErrorDependencies.EditType = EditType.NoEdit;
    eManuallyErrorDependencies.DefaultValue = "0";
    eManuallyErrorDependencies.Visible = QS.Roles.isQSAdmin;
}

Now Columnwith (Columnheader and Column) are not match. Please see attached file.

How can I do this?

Posted: September 9, 2009 12:23 PM

Great

Thanks James!

Posted: September 9, 2009 10:57 AM

Hi James

I want refresh date before I check Dependencies. I have add grd.Refresh()

Now I get sometimes following Message:

Please wait while WebGrid is in progress processing request...

Is refresh performed asynchronously? Is there a way to refresh data first?

function grd_OnAcceptAllChanges(controlId) {

    var grd = ISGetObject(controlId);
    grd.Refresh();

    var DelChanges = grd.GetChanges("Deleted");
    for (var i in DelChanges) {
        if (DelChanges[i].Row.GetCell("Dependencies").Value != "0") {
            DelChanges[i].Row.UndoChanges();
            alert("Row can't be deleted: " + DelChanges[i].Row.GetCell("Name").Value);
        }
    }
    return true;
} 
Posted: September 9, 2009 5:40 AM

The user should not be able to delete some rows.

I will check this before the data is sent to the database. Has User deleted a row which has Dependencies (e.g. foreign key constraint), I will undo changes (for this row only).

With ClientSideEvent "OnBeforeDelete" I could inform User by realtime. But this Event is not fired in Batch Update mode. Therefore, I inform the user on OnAcceptAllChanges Event.

Posted: September 9, 2009 3:34 AM

'Vertical line' issue is only visible on DefaultStyleMode = DefaultStyleKind.Elegant

Posted: September 9, 2009 2:08 AM

Now, I use ClientSideEvent OnAcceptAllChanges. Perhaps, somebody knows a better way

function grd_OnAcceptAllChanges(controlId)
{
    var grd = ISGetObject(controlId);

    var DelChanges = grd.GetChanges("Deleted");
    
    for (var i in DelChanges)
    {
        if (DelChanges[i].Row.GetCell("Dependencies").Value != "0") {
            DelChanges[i].Row.UndoChanges();
        }                 
    }
    return true;
}
All times are GMT -5. The time now is 3:54 AM.
Previous Next