Nistor Alexandru
Nistor Alexandru

Reputation: 5393

Understanding a code sample

I found an example in witch I do not understand something in asp.net webforms.The example is made using a details view control.Here is the code:

<InsertItemTemplate>
    <asp:DropDownList ID=”DropDownList1” runat=”server” 
     DataSourceID=”GenresDataSource“ DataTextField=”Name” DataValueField=”Id” 
     SelectedValue=’<%# Bind(“GenreId”) %>’>
</asp:DropDownList>
</InsertItemTemplate>

In the dropdown list I understand that:

If what I said in the the top is true what does this statement generate in the case witch GenreId is a column in a database:

<%# Bind(“GenreId”) %>’

Upvotes: 0

Views: 65

Answers (1)

Jonny C
Jonny C

Reputation: 601

This will set the selected value of the dropdown to the "GenreId". So the default value of the dropdown will be the ID.

Upvotes: 5

Related Questions