I'm trying to create a Visual Basic page that has multiple dropdown with the some set of data, but the data is called from a SQL server for its initial creation. I'm using the same SqlDataSource for all five dropdowns, but I fear it is calling it five times per row per the number of rows I have. At least, I think it is going slower than it should be.
Here is what I have for each dropdown's code
<div dlass="DataDropDownColumn">
<div>DataDropDownColumnEntry1</div>
<div class="DropDownSelectionBox">
<asp:DropDownList ID="ddlEntry1" runat="server" SelectedValue='<%# DataBinder.Eval(Container, "DataItem.Entry1") %>'
DataSourceID="SqlDataSource1" DataTextField="EntryID" DataValueField="ID" AppendDataBoundItems="true">
<asp:ListItem Selected="True" Text="Select" Value="" />
<aps:ListItem Text=" " Value="0" />
</asp:DropDownList>
</div>
</div>
<div dlass="DataDropDownColumn">
<div>DataDropDownColumnEntry2</div>
<div class="DropDownSelectionBox">
<asp:DropDownList ID="ddlEntry2" runat="server" SelectedValue='<%# DataBinder.Eval(Container, "DataItem.Entry2") %>'
DataSourceID="SqlDataSource1" DataTextField="EntryID" DataValueField="ID" AppendDataBoundItems="true">
<asp:ListItem Selected="True" Text="Select" Value="" />
<aps:ListItem Text=" " Value="0" />
</asp:DropDownList>
</div>
</div>
<div dlass="DataDropDownColumn">
<div>DataDropDownColumnEntry3</div>
<div class="DropDownSelectionBox">
<asp:DropDownList ID="ddlEntry3" runat="server" SelectedValue='<%# DataBinder.Eval(Container, "DataItem.Entry3") %>'
DataSourceID="SqlDataSource1" DataTextField="EntryID" DataValueField="ID" AppendDataBoundItems="true">
<asp:ListItem Selected="True" Text="Select" Value="" />
<aps:ListItem Text=" " Value="0" />
</asp:DropDownList>
</div>
</div>
This is repeated several times with different IDs for the ddlEntry and different matching DataBinder Evals for the ddlEntry. Again the DataSourceID for each one is the same:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand="SELECT ID FROM tblEntries ORDER BY ID"
</asp:SqlDataSource>
My belief is that there are multiple calls for each ddlEntry, even though the data is the same. Am I mistaken, and ASP is smart enough to just get the data one time, and apply it to all the HTML Dropdown List entries? It would be nice, but it seems a little slow bringing up the page.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…