[thelist] ASP.NET dropdownlist error

Ken Schaefer Ken at adOpenStatic.com
Thu Sep 27 09:12:24 CDT 2007



-----Original Message-----
From: thelist-bounces at lists.evolt.org [mailto:thelist-bounces at lists.evolt.org] On Behalf Of Joel D Canfield
Sent: Thursday, 27 September 2007 2:01 AM
To: thelist at lists.evolt.org
Subject: Re: [thelist] ASP.NET dropdownlist error

> > That's what the DataTextField (what is displayed) and the
> > DataValueField (the HTML value attribute) are for.
>
> That makes sense, which means I have no idea what Bind("DeptName") is
> doing

Did a bit of quick googling, and you can find an explanation of Bind() (compared to Eval()) here:
http://msdn2.microsoft.com/en-us/library/ms178366.aspx

So I think you need to have that value in the existing ItemTemplate object that the Bind() expression can evaluate.

But personally, I prefer to avoid all the declarative stuff.

You can do:

ddlDept.SelectedValue = "xyz"

if you wish (but that's not so easy if you have dynamically created drop down lists in a gridview or similar.

Cheers
Ken




More information about the thelist mailing list