I would like to be able to customize how data is displayed in my databound
combo box. The user will be selecting one of these values which will
correspond to a row in the database. However, I do not want it to display
in the selection items simple a single value from each row. I would like
for it to display a combination of two column values. For instance, suppose
I have this data:

ID, value1, value2
--------------------
1, data-A1, data-A2
2, data-B1, data-B2

And I want the combo box to display the items like this:
"data-A1 and data-A2" with value of 1
"data-B1 and data-B2" with value of 2

I could do this by selecting composite data in my original SELECT statement,
with: value1 + ' and ' + value2 as DisplayValue. However, this won't stay
current as I update the rows in the local cache. Is there a way to have the
databound combo box's composite display automatically update as the rows are
being modified?

Re: Custom display format for databound combo box by Sijin

Sijin
Sat Sep 04 01:54:58 CDT 2004

You can use a DataView with a column that has an expression set to the
concatentation of the two value fields.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadataviewclasstopic.asp
http://support.microsoft.com/default.aspx?scid=kb;EN-US;313485

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph



Cory Burkhardt wrote:
> I would like to be able to customize how data is displayed in my databound
> combo box. The user will be selecting one of these values which will
> correspond to a row in the database. However, I do not want it to display
> in the selection items simple a single value from each row. I would like
> for it to display a combination of two column values. For instance, suppose
> I have this data:
>
> ID, value1, value2
> --------------------
> 1, data-A1, data-A2
> 2, data-B1, data-B2
>
> And I want the combo box to display the items like this:
> "data-A1 and data-A2" with value of 1
> "data-B1 and data-B2" with value of 2
>
> I could do this by selecting composite data in my original SELECT statement,
> with: value1 + ' and ' + value2 as DisplayValue. However, this won't stay
> current as I update the rows in the local cache. Is there a way to have the
> databound combo box's composite display automatically update as the rows are
> being modified?
>
>