Wrox Programmer Forums
|
BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5
This is the forum to discuss the Wrox book Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter Kit by David Sussman, Alex Homer; ISBN: 9780764588075
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 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 November 3rd, 2007, 06:16 PM
Registered User
 
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 8 - Code doesn't produce a DropDownList


The steps under "Collecting the Delivery Address", starting on page 239, do not work. Specifically the dropDownList is not showing up. I have followed all steps twice to reproduce the error. I have also changed the code to reflect the errata found on this site. Still broken.

I'm moving on to the next step of the wizard in the mean time, but can someone let me know if you've been able to get this to work?

Here's my code (of course if you have the book, you already have the code):

Code:
<td style="width: 100px" valign="top">
    Area</td>
<td style="width: 100px" valign="top">
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="Read" TypeName="StoredShoppingCart"
        UpdateMethod="Update">
        <UpdateParameters>
            <asp:Parameter Name="DeliveryCharge" Type="Decimal" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    <asp:FormView ID="FormView1" runat="server" DefaultMode="Edit" DataSourceID="ObjectDataSource1">
        <EditItemTemplate>
            <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/XML-Data/delivery-costs.xml">
            </asp:XmlDataSource>
            Deliver to
            <asp:DropDownList ID="DropDownList" runat="server" AutoPostBack="True" DataSourceID="XmlDataSource1"
                DataTextField="name" DataValueField="delivery-cost" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"
                SelectedValue='<%# Bind("DeliveryCharge") %>'>
            </asp:DropDownList>
        </EditItemTemplate>
    </asp:FormView>
</td>
Here is the code-behind module:

Code:
    Protected Sub ObjectDataSource1_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles ObjectDataSource1.Updating
        Dim ddl As DropDownList = DirectCast(FormView1.FindControl("DropDownList1"), DropDownList)
        e.InputParameters("DeliveryCharge") = ddl.SelectedValue
    End Sub


    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        FormView1.UpdateItem(False)
    End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Query does not produce desired result snufse SQL Server 2005 0 July 2nd, 2008 12:14 PM
C# code for dropdownlist abhishekkashyap27 C# 2005 7 January 23rd, 2008 05:14 AM
expression does not produce a value shoakat ASP.NET 2.0 Professional 1 June 27th, 2007 01:33 AM
dropdownlist code-value pair mapping gagansharma7 General .NET 0 June 27th, 2006 02:11 PM
Write a program to produce a contents page eapsokha Java GUI 1 September 7th, 2004 11:19 AM





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