locked
Obout Default Grid Properties RRS feed

  • Question

  • User184402639 posted

    Hi, 

    I use the obout grid control throughout my app. I would like to control grid properties like PageSize from one location (web.config). However, I don't want to override the grid properties if it is specified in the control attributes. So in my function I have

     

    public void SetGridProperties(Grid grid)
        {
            Int16 pageSize;
    
            // do not override the property value if already set
            if (grid.PageSize == null)
            {
                if (Int16.TryParse(ConfigurationManager.AppSettings["GridPageSize"], out pageSize))
                {
                    grid.PageSize = pageSize;
    
                }
            }        
        }


    The problem is that grid.PageSize is never null. It defaults to 10 if the user does not explicitly specify the value, so I can't determine if the value was specified by the coder or by obout. Any ideas how can I accomplish this?

     

    Friday, January 21, 2011 4:56 PM

All replies

  • User-693248168 posted

    The page size property will never be null. It will default to 10 if not explicitly set by the user.

    Instead of checking for PageSize, check if AllowPaging is set to true. If the user has not set AllowPaging to true, chances are that he might not have set the PageSize also.

    Not the correct answer to what you asked, but maybe it gives you an idea.


    Saturday, January 22, 2011 12:16 PM