Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 3rd, 2008, 01:47 AM
Authorized User
 
Join Date: Sep 2007
Location: , , Thailand.
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:






  #2 (permalink)  
Old April 3rd, 2008, 01:52 AM
Authorized User
 
Join Date: Sep 2007
Location: , , Thailand.
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

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:55 PM.


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