User Profile & Activity

Yuting Zhu Member
Posted: November 25, 2009 10:55 AM

I use "EnableCaching", so when I do Sort or Filter on the Grid, Select Method retrieve the data from the cache rather than from business object that associated with it.

But I when I change the Year selection from the dropdown list, I want the refreshed data from the business object (from database). Because the data may be changed. That's why I want to clear the ISDataSource cache when the year list selection is changed.

If I don't use ISDataSource for the data binding, with AllowAutoDataCaching property on grid set to True, webgrid.Refresh() will make _webGrid_InitializeDataSource called again where retrieve the data from business object. Can the ISDataSource behave the same way?

Posted: November 24, 2009 9:14 AM

No, this does not help. It's doing the same thing. Besides I don't want to clear the session-state collection. Is there a way to just clear the ISDataSource Caching on client side or server side? My orginal attachement is a working sample, you can test the TestCachingForm to see if it works or not.

Thanks!

Posted: November 23, 2009 4:02 PM

Maybe I didn't explain the problem clear enough. I have a ISDataSource which is using CustomObject. Its SelectMethod is set to "GetLeaseActivity" which is in TestIntersoft.UI.DataLayer. You have to set a Breakpoint inside function GetLeaseActivity and debug to it. GetLeaseActivity will only get called once for the same year. For example, I selected 2009 and then 2008, and then 2009 again. GetLeaseActivity function only get called at first time I selected 2009 or 2008, not on the seconde time I select 2009.

On your sample, there is no way I can check if the SelectMothed got called on the second time.

 

The error "wg.RootTable.GetRow(i) is null" occurs as long as there is a group column. The reason you don't see the error when GroupTotalVisible = true, is that wg.RootTable.GetRow(i) is never got called since the rowscount is 0. Just want to make sure the issue "wg.RootTable.GetRow(i) is null" when there is a group column need to be fixed as well.

Thanks!

 

Handy, have you figured out a way to do this?

Thanks!

After set ColumnFooters="Yes" GroupTotalVisible="True", wg.RootTable.GetRowsCount() returns 0. The attached is a sample that shows my scenario. Please check the DisableCheckBox page.

Thanks!

You are right about disable editing and deleting in the client side but not for enable them. If I invoke JS function in InitializeLayout server side event to enable them, they will be disabled. So I have to remove the invoke script line, and then it is working. Here is the updated code snippet.

How come enable editing/deleting doesn't have to set in the client side but disable does?

Thanks!

protected void _webGrid_InitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e)
    {
        short fiscalYear = short.Parse(_fiscalYearList.SelectedValue);
        if (fiscalYear == 2009)
        {
            e.Layout.AllowAddNew = AddNew.Yes;
            e.Layout.AllowEdit = Edit.Yes;
            e.Layout.AllowDelete = Delete.Yes;

            //comment out this line, will make it to work.
            //_webGrid.ClientAction.InvokeScript("setWebGridAccess('write')");
        }
        else
        {
            e.Layout.AllowAddNew = AddNew.No;
            e.Layout.AllowEdit = Edit.No;
            e.Layout.AllowDelete = Delete.No;

            _webGrid.ClientAction.InvokeScript("setWebGridAccess('read')");
        }
    }

You hard code the row number in your sample to uncheck the rowchecker. But I have to set the ForceToEdit = false in the server for more complax condition. I then have to use a for loop to check if the cell is disabled on the client to uncheck it. It works fine only when there are no too many rows since each row calls the for loop. Is there a way to get the row object directly in this situation?

When there is a GroupColumn, wg.RootTable.GetRowsCount() returns 0 in the WebGrid1_OnCheckBoxClick. How can I fix that?

The attached is a sample.

Thanks!

Posted: September 29, 2009 1:12 PM

On your sample, you make the checkbox on each row disabled but if you click on the header checkbox, every row checkbox will become selected. That is not what I wanted. I don't want the disabled row be selectable. I modified your InitializeRow as below, it shows the way I wanted. But when you click on the header checkbox, you'll get the javascript error. Screenshot is attached.

Is there a way to make the header CheckBox to only select thoes selectable rows? If not, how can I hide or disable the header checkbox when the page is load?

Thanks,

Yuting

protected void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
    {
        //e.Row.Cells[0].ForceNoEdit = true;
        if (e.Row.Cells[2].Text == "ANATR" || e.Row.Cells[2].Text == "AROUT")
        {
            e.Row.Table.Columns[0].IsRowChecker = false;
            e.Row.ForceNoEdit = true;
        }
        else
        {
            e.Row.Table.Columns[0].IsRowChecker = true;
            e.Row.ForceNoEdit = false;
        }
    }
All times are GMT -5. The time now is 7:25 AM.
Previous Next