Intersoft WebGrid Documentation
Walkthrough: Configuring multiple values editing using WebCombo.NET 4.0 control in WebGrid
See Also Send comments on this topic.

Glossary Item Box

This walkthrough shows you how to configure multiple values editing using WebCombo.NET 4.0 control in WebGrid.

During this walkthrough, you will learn:

 Prerequisites

In order to complete this walkthrough, you will need the following:

  • Visual Studio 2005 Application.

 Step-By-Step Instructions

To Configure multiple values editing using WebCombo.NET 4.0 control in WebGrid

  1. Launch Visual Studio.NET 2005.
  2. Click on File menu, then select New and click Project.
  3. Select Visual C# Project in Project Types.
  4. Select ASP.NET Web Application in the Template box.
  5. Specify the Project's Location and click OK.
  6. Drag a WebGrid instance into WebForm.
  7. Drag a WebCombo instance into WebForm. 
  8. Drag two SqlDataSource controls into WebForm.
  9. Right click to the SqlDatasource1 and select Configure Datasource, then choose SqlSampleConnection.
  10. Select statement "SELECT * FROM [Employees]".

    SqlEmployees
  11. Right click to the SqlDatasource2 and select Configure Datasource, then choose SqlSampleConnection.
  12. Select statement "SELECT [RoleId], [RoleName] FROM [Roles]".

    SqlRoles
  13. Right click on WebCombo instance and choose Properties.
  14. Set DataTextField to "RoleName" and DataValueField to "RoleId".
  15. Right click on WebCombo instance and choose WebCombo.NET Designer.
  16. Go to Advanced Features, set the MultipleSelection Enabled to True, and SeparatorChar to ",".
  17. In Advanced Settings, LayoutSettings, set the following properties:

    Property Value
    AllowFloatingText False
    BoundMode ForceUnbound
    TextMode ReadOnly
    StatusBoxVisible False

  18. Place the following code in Page_Load server side event.
    C# Copy Code
    protected void Page_Load(object sender, EventArgs e)    
    {        
       if (!IsPostBack)        
       {            
          /* populate data as unbound to enable checkbox mode in multiple selection */            
          DataView view = SqlDataSource2.Select(DataSourceSelectArguments.Empty) as DataView;            
          WebCombo1.PopulateUnboundData(view, true);       
       }    
    }
    

  19. Open WebGrid.NET Designer - RootTable - Columns. Add EmployeeID, FirstName, LastName, JoinDate, Roles columns.
  20. In Advanced Settings, LayoutSettings, set AllowEdit to Yes.
  21. In the Roles properties, expand ValueList and set the following properties:

    Property Value
    DataSourceID SqlDataSource2
    DataTextField RoleName
    DataValueField RoleId
    EnableMultipleValues True

  22. Set Edit Control Type to "WebComboNET" and choose WebComboID to "WebCombo1"
  23. Compile and run the WebForm. The WebGrid will look like following.

  24. WebComboMultipleValues

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.