WebGrid Community Server

Welcome to WebGrid Community Server Sign in | Join | Help
in Search

WebGrid ignores column definition when using ObjectDataSource

Last post 07-22-2008, 15:16 by machine. 10 replies.
Sort Posts: Previous Next
  •  07-19-2008, 22:49 649

    WebGrid ignores column definition when using ObjectDataSource

    Perhaps I'm overlooking a setting, but when I replace the native GridView with a WebGrid on a page using an ObjectDataSource, WebGrid generates columns for every method/property of the data object, even though I have defined a few columns in the <columns> key of the control.  The behavior is similar to the native GridView when "AutoGenerateColumns" is set to True.  Is there an equivalent property for WebGrid to recognize the column definition and not generate the additional columns?

    Thanks for the help and the great tool!

    7/18/08 build of WebGrid
    Visual Studio 2008
    .NET FW 3.5
  •  07-20-2008, 2:30 650 in reply to 649

    Re: WebGrid ignores column definition when using ObjectDataSource

    I have noticed this as well since updating to the newest version.
  •  07-21-2008, 0:16 652 in reply to 650

    Re: WebGrid ignores column definition when using ObjectDataSource

    You should use 'visibility' property to set the visibility for a column. You can set the grid's default column visibility by 'DefaultVisibility'

    I hope this help you out.

    Olav Botterli, WebGrid Founding Developer
  •  07-21-2008, 15:54 657 in reply to 652

    Re: WebGrid ignores column definition when using ObjectDataSource

    Thank you for the response.  Setting the "DefaultVisibility" property of the grid to "None" and the "Visibility" property of each defined column to "Both" did hide the extra columns.  However, it appears that WebGrid is still calling all the properties and methods of the Data Object. As a result, the Data Object is performing a lot more work and taking longer to respond when using WebGrid versus the native GridView which only executes the methods and properties attributed with the defined columns.

    I think this is a great tool and I'm looking forward to using it with my projects.
  •  07-21-2008, 16:40 660 in reply to 657

    Re: WebGrid ignores column definition when using ObjectDataSource

    Hi, Do you how to show a dropdown in the web grid? I am binding the webgrid in code behind and not using any datasourceid in the aspx.

    Any help will be appreciated.

    Thanks.

  •  07-21-2008, 17:28 661 in reply to 660

    Re: WebGrid ignores column definition when using ObjectDataSource

    Vinny:

    Hi, Do you how to show a dropdown in the web grid? I am binding the webgrid in code behind and not using any datasourceid in the aspx.


    No offense Vinny, but this is not the appropriate forum for this question and thread-hijacking is not appreciated.
  •  07-21-2008, 17:56 662 in reply to 661

    Re: WebGrid ignores column definition when using ObjectDataSource

    Hi, I'm sorry about that.

    Vinny

  •  07-21-2008, 21:04 664 in reply to 657

    Re: WebGrid ignores column definition when using ObjectDataSource

    That's true. You should set 'IsInDataSource=false' for these column you don't want to load :-)

    Olav Botterli, WebGrid Founding Developer
  •  07-21-2008, 23:41 665 in reply to 664

    Re: WebGrid ignores column definition when using ObjectDataSource

    Thanks for the reply.  The trouble is that WebGrid appears to be executing all the methods/properties of the DataObject and not just the few that are described in the design view.  Are you suggesting I explicitly add all the columns for the data object and set the IsIndataSource value to False for all the columns except the ones I want to show?

    Thanks again!
  •  07-22-2008, 2:06 666 in reply to 665

    Re: WebGrid ignores column definition when using ObjectDataSource

    Yes.

    I don't know how many columns you have, but you could also do this in 'code-behind'. That way you don't need to set these in your aspx / ascx file.

    I see the benefit by having a property to only load visible columns from the data source, and this should also be easy to implement in WebGrid.

    Olav Botterli, WebGrid Founding Developer
  •  07-22-2008, 15:16 667 in reply to 666

    Re: WebGrid ignores column definition when using ObjectDataSource

    Thank you for the clarification, I may begin replacing the GridView controls with your valuable tool in this way for the grids that use simpler Data objects.

    I'll keep an eye out for an updated version of WebGrid.   Thanks again for your help and the use of WebGrid!

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems