i want to get the order by Title like this...
| Beer Cap | from |________| to |_________| load
----------
| Glass #2 |
----------
| Glass #3 |
----------
.
.
.
i modify the shopping system in the ManageOrders.aspx like this
...
<p></p>
<div class="sectionsubtitle">Orders by Product</div>
Product: <asp:DropDownList ID="ddlOrderProduct" runat="server" DataSourceID="objAllProducts" DataTextField="Title" DataValueField="ID" />
<asp:ObjectDataSource ID="objAllProducts" runat="server" SelectMethod="GetProducts"
TypeName="MB.TheBeerHouse.BLL.Store.Product"></asp:ObjectDataSource>
from: <asp:TextBox ID="txtFromDate1" runat="server" Width="80px" />
to: <asp:TextBox ID="txtToDate1" runat="server" Width="80px" />
<asp:Button ID="btnListByProduct" runat="server" Text="Load" ValidationGroup="ListByProduct" />
<asp:RequiredFieldValidator ID="valRequireFromDate1" runat="server" ControlToValidate="txtFromDate1" SetFocusOnError="true" ValidationGroup="ListByProduct"
Text="<br />The From Date field is required." ToolTip="The From Date field is required." Display="Dynamic"></asp:RequiredFieldValidator>
<asp:CompareValidator runat="server" ID="valFromDateType1" ControlToValidate="txtFromDate1" SetFocusOnError="true" ValidationGroup="ListByProduct"
Text="<br />The format of the From Date is not valid." ToolTip="The format of the From Date is not valid."
Display="Dynamic" Operator="DataTypeCheck" Type="Date" />
<asp:RequiredFieldValidator ID="valRequireToDate1" runat="server" ControlToValidate="txtToDate1" SetFocusOnError="true" ValidationGroup="ListByProduct"
Text="<br />The To Date field is required." ToolTip="The To Date field is required." Display="Dynamic"></asp:RequiredFieldValidator>
<asp:CompareValidator runat="server" ID="valToDateType1" ControlToValidate="txtToDate1" SetFocusOnError="true" ValidationGroup="ListByProduct"
Text="<br />The format of the To Date is not valid." ToolTip="The format of the To Date is not valid."
Display="Dynamic" Operator="DataTypeCheck" Type="Date" />
<p></p>
and in Manage.aspx.
vb has source code...
Protected Sub DoBinding()
....
Dim listByProduct As Boolean = False
If Not String.IsNullOrEmpty(gvwOrders.Attributes("ListByP roduct")) Then _
listByProduct = Boolean.Parse(gvwOrders.Attributes("ListByProduct" ))
If listByProduct Then
orders = BLL.Store.Order.GetOrdersByTitle((ddlOrderProduct. SelectedValue), _
Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text))
End If
gvwOrders.DataSource = orders
gvwOrders.DataBind()
...
Protected Sub btnListByProduct_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnListByProduct.Click
gvwOrders.Attributes.Add("ListByProduct", True.ToString())
DoBinding()
End Sub
and i add the Function GetOrdersByTitle and Property Title entire in store system
when i click load it has error ....
Title
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IndexOutOfRangeException: Title
Source Error:
Line 239: End If
Line 240:
Line 241: Return New OrderDetails(CInt(reader("OrderID")), _
Line 242: reader("Title").ToString(), _
Line 243: CDate(reader("AddedDate")), _
Source File: C:\TBH_Web\App_Code\DAL\StoreProvider.
vb Line: 241
Stack Trace: