Hello-- I have an ordering screen that displays hundreds of items in a datagrid and provides a blank for the user to enter a Quantity. Datagrid "CatalogGrid" is bound to a datasource which is based on the System.Collection.CollectionBase class. If the user has entered a Quantity on a row, the quantity is displayed on the same datagrid row via a datasource which is based on the System.Collections.DictionaryBase class. (See code snippets below.)
My goal is to create a new Order Preview page that shows only ordered items, allowing the user to change the quantity or delete. In that situation, ss there a way to hide rows where the Quantity is blank, while still using this datasource implementation? See mock-up image here: http://www.enardoni.com/download/orderpreview_mockup.gif
Thank you in advance for your consideration!
===
ASP.NET with Visual Basic, using Visual Studio 2003. I'm a relatively new developer who inherited the source code from an expert programmer, so please bear with me!
From the ASPX page:
<asp:BoundColumn DataField="ItemNumber" HeaderText="Item #">
<HeaderStyle Width="3%"></HeaderStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Qty">
<HeaderStyle Width="5%"></HeaderStyle>
<ItemTemplate>
<asp:TextBox id="QuantityTextbox" runat="server" [B]Text='<%# DataGrid_BindQuantity(DataBinder.Eval(Container, "DataItem.ItemId")) %>'[/B] </asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
From the code-behind:
CatalogGrid.DataSource = CatalogItems.PageFill
CatalogGrid.DataBind()
Protected Function DataGrid_BindQuantity(ByVal dataItem As Object) As String
Dim value As String = String.Empty
Dim ThisOrder As MyOrderClass = CType(Me.GetSessionValue("Order"), MyOrderClass)
If Not IsNothing(ThisOrder) Then
Dim ItemId As String = dataItem.ToString
If ThisOrder.OrderedItems.Contains(ItemId) Then
value = ThisOrder.OrderedItems(ItemId).Quantity.ToString()
End If
End If
Return value
End Function