Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > two-way data binding with dropdown

Reply
Thread Tools

two-way data binding with dropdown

 
 
ba
Guest
Posts: n/a
 
      08-16-2005
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot select two-way data binding property on a dropdown list con Mike Milian ASP .Net 0 04-14-2008 02:49 AM
1 Gridview. Dropdown A is column from database, Dropdown B is column from database, Data in A and B must be from same row. anonymoushamster@gmail.com ASP .Net 2 11-07-2007 12:40 PM
data binding and dropdown lsit goodwill ASP .Net 1 10-22-2005 10:30 AM
Data binding in TextBox after dropdown list indexchanged =?Utf-8?B?ZGF2aWQ=?= ASP .Net 5 04-04-2005 12:43 PM
Dropdown List data binding Binod Nair ASP .Net 3 01-16-2004 09:14 PM



Advertisments