ASPxGridView Screencast: Unbound Columns

In this screencast you’ll learn how to display unbound data using unbound columns.

Unbound data is typically data that does not come from your datasource. Data like calculated columns which you can easily define in the ASPxGridView.

Check out the screencast and then let me know your thoughts. A how-to is also posted below. Thanks!

image

 


 

How to create Unbound Columns in the ASPxGridView

To add an Unbound column just follow these easy steps:

  1. Add a new column to the ASPxGridView
  2. Assign the data value in the CustomUnboundColumnData event

Add the new unbound column

Click on the smart tag of the ASPxGridView and select Columns from the menu. The columns editor form you see below will appear. Use the two icons on the top left corner of the form to add or insert a new column. When clicking on one of these buttons, a dropdown will appear that let’s you select the type of column to add. You can select any type that fits your column/data type but the Text Column is the general type:

image

Now define some properties for the column like the Caption(header), FieldName, UnboundType, and possibly DisplayFormatString. Since this is an unbound column, you should define UnboundType to match the data type you’ll be adding to the field. The FieldName will be used when filling the value and must be unique from any other fields in your datasource.

image

Assign a value to your unbound column

To fill the new column with data, you should handle the CustomUnboundColumnData event. Here you can assign the data value using the e.Value property. In the sample, note the e.GetListSourceFieldValue method and e.Column.FieldName property. You can use these items to check for the column and field values in the method.

image

Now run the application and you have the unbound column you just created with just a few easy steps.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s