A
Andrew Todd
Hi
I have an asp:checkboxlist bound to a datagrid.
The datagrid contains a table with 3 columns: itemId, description and cost.
In my checkboxlist I set the datatextfield property to the 'description'
field from my datagrid and the datavaluefield property to the 'itemId'
field. If I run this, it works as expected and produces a list similar to
below (where x is a checkbox):
x Item 1
x Item 2
x Item 3
etc.
What I'd like to do is to use both the description *and* the cost columns
from my datagrid for the text field in the checkboxlist, e.g:
x Item 1 (£10)
x Item 2 (£23)
x Item 3 (£5)
Where 'Item 1' is contained in the 'Description' filed and '£10' is
contained in the 'cost' field.
My checkbox list tag currently looks like:
<asp:CheckBoxList id="partsList" runat="server" DataMember="Part"
DataTextField="Description" DataValueField="itemId"></asp:CheckBoxList>
And then in my codebehind I set the DataSource of the list to be my DataGrid
and call DataBind();
Could anyone explain how to use multiple values in this way?
Thanks
Andrew
I have an asp:checkboxlist bound to a datagrid.
The datagrid contains a table with 3 columns: itemId, description and cost.
In my checkboxlist I set the datatextfield property to the 'description'
field from my datagrid and the datavaluefield property to the 'itemId'
field. If I run this, it works as expected and produces a list similar to
below (where x is a checkbox):
x Item 1
x Item 2
x Item 3
etc.
What I'd like to do is to use both the description *and* the cost columns
from my datagrid for the text field in the checkboxlist, e.g:
x Item 1 (£10)
x Item 2 (£23)
x Item 3 (£5)
Where 'Item 1' is contained in the 'Description' filed and '£10' is
contained in the 'cost' field.
My checkbox list tag currently looks like:
<asp:CheckBoxList id="partsList" runat="server" DataMember="Part"
DataTextField="Description" DataValueField="itemId"></asp:CheckBoxList>
And then in my codebehind I set the DataSource of the list to be my DataGrid
and call DataBind();
Could anyone explain how to use multiple values in this way?
Thanks
Andrew