Is it possible to return all values from a table using a datareader, then select the values displayed in a bound control using another pulldownmenu, without requerying the database. At the moment every time i change the category dropdown menu selection it has to reload the page. Can't i just select the values from the original datareader results provided on Page_Load event. Heres what i have at the moment:
===========================================================
Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
' Obtain ProductDefinition information from ProductDefinition table
' and bind to the datareader control
Dim products As New ASPNetPortal.ProductsDB()
' DataBind ProductDefinition to DataReader Control
ProductList.DataSource = products.GetAllProductDefinitions()
ProductList.DataValueField = "ProductDefinitionID"
ProductList.DataTextField = "Description"
ProductList.DataBind()
End Sub
Sub Index_Changed(ByVal sender As Object, ByVal E As EventArgs)
' Obtain ProductDefinition information from ProductDefinition table
' and bind to the datareader control
Dim products As New ASPNetPortal.ProductsDB()
Dim strCategoryID = ProductCategory.SelectedItem.Value
' DataBind ProductDefinition to DataReader Control
ProductList.DataSource = products.GetProductDefinitions(strCategoryID)
ProductList.DataValueField = "ProductDefinitionID"
ProductList.DataTextField = "Description"
ProductList.DataBind()
End Sub
:
:
:
:
<aspropDownList id="ProductCategory" OnSelectedIndexChanged="Index_Changed" AutoPostBack="true" runat="server" CssClass="Normal">
<asp:ListItem Value="1">Category1</asp:ListItem>
<asp:ListItem Value="2">Category2</asp:ListItem>
<asp:ListItem Value="3">Category3</asp:ListItem>
<asp:ListItem Value="4">Category4</asp:ListItem>
<asp:ListItem Value="5">Category5</asp:ListItem>
</aspropDownList>
:
:
:
<asp:ListBox id="ProductList" selectionmode="Multiple" width="250" Rows="10" runat="server" class="Normal" />
===========================================================
Many thanks in advance,
si
===========================================================
Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
' Obtain ProductDefinition information from ProductDefinition table
' and bind to the datareader control
Dim products As New ASPNetPortal.ProductsDB()
' DataBind ProductDefinition to DataReader Control
ProductList.DataSource = products.GetAllProductDefinitions()
ProductList.DataValueField = "ProductDefinitionID"
ProductList.DataTextField = "Description"
ProductList.DataBind()
End Sub
Sub Index_Changed(ByVal sender As Object, ByVal E As EventArgs)
' Obtain ProductDefinition information from ProductDefinition table
' and bind to the datareader control
Dim products As New ASPNetPortal.ProductsDB()
Dim strCategoryID = ProductCategory.SelectedItem.Value
' DataBind ProductDefinition to DataReader Control
ProductList.DataSource = products.GetProductDefinitions(strCategoryID)
ProductList.DataValueField = "ProductDefinitionID"
ProductList.DataTextField = "Description"
ProductList.DataBind()
End Sub
:
:
:
:
<aspropDownList id="ProductCategory" OnSelectedIndexChanged="Index_Changed" AutoPostBack="true" runat="server" CssClass="Normal">
<asp:ListItem Value="1">Category1</asp:ListItem>
<asp:ListItem Value="2">Category2</asp:ListItem>
<asp:ListItem Value="3">Category3</asp:ListItem>
<asp:ListItem Value="4">Category4</asp:ListItem>
<asp:ListItem Value="5">Category5</asp:ListItem>
</aspropDownList>
:
:
:
<asp:ListBox id="ProductList" selectionmode="Multiple" width="250" Rows="10" runat="server" class="Normal" />
===========================================================
Many thanks in advance,
si