| | | 
Forum Guru
       
Group: Forum Members Last Login: 2/10/2009 12:52:26 PM Posts: 50, Visits: 221 |
| Hi,
today in the class, i was asked how to bind the dropdownlist to a sqldatasource, as wells as adding some static items. It is easy, you set the AppendDataBoundItems property of the dropdownlist to true, and add your static item., an example is below: there is a dropdownlist binded to sqldatasource which gets the categories from the northwind database, and also a static listitem is added to the dropdownlist. you can also see, how we can use requiredfieldvalidator :
[php]
ropDownList ID="listCategories" runat="server"
DataSourceID="SqlDataSource1" DataTextField="CategoryName"
DataValueField="CategoryID" AppendDataBoundItems="True">
ropDownList>
Text="(Required)" ControlToValidate="listCategories" runat="server" />
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Categories]">
[/php]

test
|
| | | | Forum Newbie
       
Group: Forum Members Last Login: 6/21/2008 7:09:10 AM Posts: 9, Visits: 23 |
| | Thanks Volkan! But, why the [php]? Are those tags for VS2008? Will you be posting your slides from Weeks 4 and 5 here too? I will post my application soon, but I've been busy at work lately (conversion headaches). It is working, but I want to do some cleanup before I post it. Steve P.S. You are to be commended for doing an excellent job of teaching us ASP.NET. I have already gained much insight and have been able to leverage what I already know in Delphi, Java, and Oracle toward C#, ASP.NET, and SQL Server. I personally feel the class has been worth my time.
Free advice! Worth every cent! |
| | | | 
Forum Guru
       
Group: Forum Members Last Login: 2/10/2009 12:52:26 PM Posts: 50, Visits: 221 |
| | Hi Stevem i keep forgetting the slides, i ll do it tonight. i put the [php] tags cause %99 of the forums in the world support this special tag, and anything u put in between this tag should be formatted nicely . apprarently our forum doesnt support it

test
|
| | | | Forum Newbie
       
Group: Forum Members Last Login: 6/21/2008 7:09:10 AM Posts: 9, Visits: 23 |
| | Ah... I see: [php] injection! Looking forward to the slides. Gotta head out to work now...
Free advice! Worth every cent! |
| |
|
|