B
ba
I'm using asp.net 2.0 and am writing a webform using the formview
control.
The <%# Bind("") %> syntax makes sense for textboxes, but I cannot
figure out how to bind a dropdown list to a column.
The values to be entered from the dropdownlist are YES and NO. I want
the source of the dropdown to be one of these two choices.
When the record is in 'edit mode', I want the dropdown list selected
value to be what it is in the record. Then when the user changes the
value (or not), it is bound to that column and the update takes place.
I get close with:
<aspropDownList ID="ddlProduct_Active" runat="server"
DataValueField="Product_Active" DataTextField="Product_Active"
SelectedValue = '<%# Bind("Product_Active") %>'
DataSourceID="SqlDataSource1">
</aspropDownList>
However, the above causes ALL the records in the dataset to have their
values displayed in the dropdownlist (lots os YES and NO). I just want
YES and NO as the only two values
I tried making a business object for the datasourceid and in that object
creating a data table, but did not do the trick.
Appreciate any tips.
control.
The <%# Bind("") %> syntax makes sense for textboxes, but I cannot
figure out how to bind a dropdown list to a column.
The values to be entered from the dropdownlist are YES and NO. I want
the source of the dropdown to be one of these two choices.
When the record is in 'edit mode', I want the dropdown list selected
value to be what it is in the record. Then when the user changes the
value (or not), it is bound to that column and the update takes place.
I get close with:
<aspropDownList ID="ddlProduct_Active" runat="server"
DataValueField="Product_Active" DataTextField="Product_Active"
SelectedValue = '<%# Bind("Product_Active") %>'
DataSourceID="SqlDataSource1">
</aspropDownList>
However, the above causes ALL the records in the dataset to have their
values displayed in the dropdownlist (lots os YES and NO). I just want
YES and NO as the only two values
I tried making a business object for the datasourceid and in that object
creating a data table, but did not do the trick.
Appreciate any tips.