Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 3rd, 2008, 01:47 AM
Authorized User
 
Join Date: Sep 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default i want to modify the shopping

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:






 
Old April 3rd, 2008, 01:52 AM
Authorized User
 
Join Date: Sep 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

and in the Order.vb i add Function that has source code ...

 Public Shared Function GetOrdersByTitle(ByVal Title As String, ByVal fromdate As DateTime, ByVal todate As DateTime) As List(Of Order)
            todate = todate.AddDays(1).Subtract(New TimeSpan(todate.Hour, todate.Minute, todate.Second))
            Dim orders As List(Of Order)
            Dim key As String = "Store_Orders_" & Title & "_" & fromdate.ToShortDateString() & "_" & todate.ToShortDateString()

            If BaseStore.Settings.EnableCaching AndAlso Not IsNothing(BizObject.Cache(key)) Then
                orders = CType(BizObject.Cache(key), List(Of Order))
            Else
                Dim recordset As List(Of OrderDetails) = SiteProvider.Store.GetOrdersByTitle(Title, fromdate, todate)
                orders = GetOrderListFromOrderDetailsList(recordset)
                BaseStore.CacheData(key, orders)
            End If
            Return orders






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Modify GetThreadsRss kherrerab BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 January 22nd, 2008 12:14 PM
Modify XSLT mikeymikey XSLT 4 January 5th, 2008 11:21 PM
How to modify "for-each" to "last occurrence of" ? nyctechwriter XSLT 3 October 30th, 2006 01:15 PM
How to modify hidden value? Edward King Javascript 2 January 21st, 2006 05:44 AM
How can I modify script timeout? tlbacon527 Classic ASP Professional 3 February 5th, 2004 09:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.