Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to populate a dropdown list in asp.net from a DB table
    primarykey
    data
    text
    <p>I'm new to asp.net and I want to populate a dropdown list with values from a table I created. I only want to populate the list with one of the fields- the languages in my table. I think I have connected to the data source correctly, but I don't know what I have to do to get the values into the list. I can enter my own values but I'd rather have this automated.</p> <p>This is what I have so far, but I'm guessing there's more to it than just linking the list to the data source. Any help would be greatly appreciated.</p> <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="&lt;%$ ConnectionStrings:HBshareIndexConnectionString %&gt;" SelectCommand="SELECT * FROM [Web_Metrics] WHERE ([LCID] = @LCID)"&gt; &lt;SelectParameters&gt; &lt;asp:QueryStringParameter Name="LCID" QueryStringField="LCID" Type="Int32" /&gt; &lt;/SelectParameters&gt; &lt;/asp:SqlDataSource&gt; &lt;asp:Label ID="Label1" runat="server" Text="Select LCID: " &gt;&lt;/asp:Label&gt; &amp;nbsp; &amp;nbsp; &lt;asp:DropDownList ID="DropDownList1" Width="150px" runat="server" DataSourceID="SqlDataSource1" DataTextField="LCID" DataValueField="LCID"&gt; &lt;asp:ListItem&gt;Select LCID...&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; </code></pre> <p>Hi Guys, thanks for the help. I got the dropdown list populated now, but I was wondering how do I actually get the repeater I'm using to display the details of the LCID the person selects? I've seen people talking about page.isPostback but I don't know what that is or if it works with my current setup. I need to somehow get the LCID they selected and then refresh the page to show the details of that LCID. Does anyone have any ideas? Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload