0

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:

  • DataTextField - represent the name of the item that is shown in the dropdown
  • DataValueField = represents the value of the selected Item
  • SelectedValue - I think it represent the item the user selects but I am not sure corect me if I am wrong

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”) %>’ 
0

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.