View Single Post
  #6 (permalink)  
Old March 12th, 2009, 09:53 PM
Lee Dumond's Avatar
Lee Dumond Lee Dumond is offline
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Actually, looking at what you're trying to do a bit more closely, it looks like what you have is probably OK. From here, you should be able to simply bind the SelectedValue property of the DropDownList using two-way databinding, like this:

Code:
<EditItemTemplate>
    <asp:DropDownList ID="DropDownList1" 
        runat="server" AutoPostBack="False" DataSourceID="SqlDataSource3" 
        DataTextField="Name" DataValueField="Name" SelectedValue='<%# Bind("Category") %>'>
    </asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
    <asp:Label ID="Label1" runat="server" Text='<%# Bind("Category") %>'></asp:Label>
</ItemTemplate>
That should work.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}