Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 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 Display Modes
  #1 (permalink)  
Old December 4th, 2008, 04:43 PM
Authorized User
 
Join Date: Dec 2008
Location: , , Greece.
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via MSN to fh84
Default Problem with try it out on page 248

Hello,
I just doing exactly that the books says and when finally I select an option from the drop down menu, does not update the data list.
I download the c# code and does the same thing.
Could you please give me advice?
Thank you in advanced


  #2 (permalink)  
Old December 6th, 2008, 09:06 AM
Authorized User
 
Join Date: Dec 2008
Location: , , Greece.
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via MSN to fh84
Default

What I actually try to do is using a dropdownmenu and through the database to update the combobox. Unfortunately it does not update the combobox. I also post the code. Please help!!!

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Fixtures.aspx.cs" Inherits="Fixtures" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
        DataKeyNames="FixtureID" DataSourceID="SqlDataSource1"
        EmptyDataText="There are no data records to display.">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="FixtureID" HeaderText="FixtureID" ReadOnly="True"
                SortExpression="FixtureID" />
            <asp:BoundField DataField="FixtureDate" HeaderText="FixtureDate"
                SortExpression="FixtureDate" />
            <asp:BoundField DataField="FixtureType" HeaderText="FixtureType"
                SortExpression="FixtureType" />
            <asp:BoundField DataField="GoalsFor" HeaderText="GoalsFor"
                SortExpression="GoalsFor" />
            <asp:BoundField DataField="GoalsAgainst" HeaderText="GoalsAgainst"
                SortExpression="GoalsAgainst" />
            <asp:BoundField DataField="Notes" HeaderText="Notes" SortExpression="Notes" />
            <asp:BoundField DataField="Opponents" HeaderText="Opponents"
                SortExpression="Opponents" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:WroxUnited %>"
        DeleteCommand="DELETE FROM [Fixtures] WHERE [FixtureID] = @FixtureID"
        InsertCommand="INSERT INTO [Fixtures] ([FixtureDate], [FixtureType], [GoalsFor], [GoalsAgainst], [Notes], [Opponents]) VALUES (@FixtureDate, @FixtureType, @GoalsFor, @GoalsAgainst, @Notes, @Opponents)"
        ProviderName="<%$ ConnectionStrings:WroxUnited.ProviderName %>"
        SelectCommand="SELECT [FixtureID], [FixtureDate], [FixtureType], [GoalsFor], [GoalsAgainst], [Notes], [Opponents] FROM [Fixtures]"
        UpdateCommand="UPDATE [Fixtures] SET [FixtureDate] = @FixtureDate, [FixtureType] = @FixtureType, [GoalsFor] = @GoalsFor, [GoalsAgainst] = @GoalsAgainst, [Notes] = @Notes, [Opponents] = @Opponents WHERE [FixtureID] = @FixtureID">
        <DeleteParameters>
            <asp:Parameter Name="FixtureID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="FixtureDate" Type="DateTime" />
            <asp:Parameter Name="FixtureType" Type="String" />
            <asp:Parameter Name="GoalsFor" Type="Int16" />
            <asp:Parameter Name="GoalsAgainst" Type="Int16" />
            <asp:Parameter Name="Notes" Type="String" />
            <asp:Parameter Name="Opponents" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="FixtureDate" Type="DateTime" />
            <asp:Parameter Name="FixtureType" Type="String" />
            <asp:Parameter Name="GoalsFor" Type="Int16" />
            <asp:Parameter Name="GoalsAgainst" Type="Int16" />
            <asp:Parameter Name="Notes" Type="String" />
            <asp:Parameter Name="Opponents" Type="String" />
            <asp:Parameter Name="FixtureID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <br />
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
        DataKeyNames="FixtureID" DataSourceID="SqlDataSource2" Height="50px"
        Width="500px">
        <Fields>
            <asp:BoundField DataField="FixtureID" HeaderText="FixtureID"
                InsertVisible="False" ReadOnly="True" SortExpression="FixtureID" />
            <asp:BoundField DataField="Notes" HeaderText="Notes" SortExpression="Notes" />
        </Fields>
    </asp:DetailsView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"
        ConnectionString="<%$ ConnectionStrings:WroxUnited %>"
        SelectCommand="SELECT [FixtureID], [Notes] FROM [Fixtures] WHERE ([FixtureID] = @FixtureID)">
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" DefaultValue="1" Name="FixtureID"
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />
</asp:Content>



  #3 (permalink)  
Old December 6th, 2008, 09:23 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,044
Thanks: 80
Thanked 1,580 Times in 1,557 Posts
Default

Euhhm, what drop down are you talking about? I see none in your code, so either this is not the relevant code, or it's incomplete?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
  #4 (permalink)  
Old December 6th, 2008, 12:21 PM
Authorized User
 
Join Date: Dec 2008
Location: , , Greece.
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via MSN to fh84
Default

i am very sorry guys this the real code :
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:DropDownList ID="DropDownList1" runat="server"
        AutoPostBack="True"
        DataSourceID="SqlDataSource2"
        DataTextField="FixtureCombo"
        DataValueField="FixtureID">
    </asp:DropDownList>

    <asp:SqlDataSource ID="SqlDataSource2" runat="server"
        ConnectionString="<%$ ConnectionStrings:WroxUnited %>"
        SelectCommand="SELECT [FixtureID], (Opponents + '-' + CONVERT(varchar, FixtureDate, 6)) As FixtureCombo From [Fixtures] ORDER BY [FixtureDate]">
    </asp:SqlDataSource>
    <br />

    <asp:DataList ID="DataList1" runat="server"
        DataKeyField="PictureID"
        DataSourceID="SqlDataSource1"
        RepeatColumns="3"
        RepeatDirection="Horizontal">
        <ItemTemplate>
            FixtureID:
            <asp:Label ID="FixtureIDLabel" runat="server"
            Text='<%# Eval("FixtureID") %>' />
            <br />
            PictureID:
            <asp:Label ID="PictureIDLabel" runat="server"
            Text='<%# Eval("PictureID") %>' />
            <br />
            <asp:Image ID="Image1" runat="server"
                ImageUrl='<%# Eval("PictureURL", "~/MatchImages/{0}") %>' />
            <br />
            Uploaded By Member Name:
            <asp:Label ID="UploadedByMemberNameLabel" runat="server"
                Text='<%# Eval("UploadedByMemberName") %>' />
            <br />
            <asp:Label ID="NotesLabel" runat="server" Text='<%# Eval("Notes") %>' />
            <br />
        </ItemTemplate>
    </asp:DataList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:WroxUnited %>"
        SelectCommand="SELECT * FROM [Gallery] WHERE ([FixtureID] = @FixtureID)">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" DefaultValue="1"
                Name="FixtureID" PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>

  #5 (permalink)  
Old December 6th, 2008, 12:30 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,044
Thanks: 80
Thanked 1,580 Times in 1,557 Posts
Default

OK. and what exactly is the problem? What do you expect the page to do and when and how? And what does it do instead now? Do you get any errors?

Imar

BTW: did you check the errata? I see a lot of stuff listed for this code. You'll need to check for yourself here: http://www.wrox.com/WileyCDA/Section...&field=keyword as I don't know what book you have exactly.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
  #6 (permalink)  
Old December 6th, 2008, 12:34 PM
Authorized User
 
Join Date: Dec 2008
Location: , , Greece.
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via MSN to fh84
Default

According to try it out on page 248, by the time you select an option from the drop down menu, it has to print the result on the memo box. But it does nothing, neither appears an error. On the final's example code, it does the same thing.

  #7 (permalink)  
Old December 6th, 2008, 12:45 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,044
Thanks: 80
Thanked 1,580 Times in 1,557 Posts
Default

I don't have the book nor the sample code you're talking about, but from what I can see, it looks fine.

What do you see in the HTML source of the page for the drop down list? Are you sure that there are records in the Gallery table with a FixtureID that corresponds to one of the items in the drop down list?

In other words, maybe it just works fine, but there are simply no results.....

Did you check the errata?

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
  #8 (permalink)  
Old December 6th, 2008, 12:52 PM
Authorized User
 
Join Date: Dec 2008
Location: , , Greece.
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via MSN to fh84
Default

well, i checked the database, and there are plenty of records. below, i paste the html code when i picked one of the options:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head><title>
    Untitled Page
</title></head>
<body>
    <form name="aspnetForm" method="post" action="Gallery.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="HCUyJEFMSJuPENZ1eHi4vrIKJxpWsZWntSrLSlpv8Ne 3M5q9U/KF7A0i3y7Gb5RKuHx6ETyGO9V3I11sD0fLb5GCewJl42ZG5TJD fJGdwjYIktem0YRgY7tikbWBHQf7W+Fy/XZDUr/ppWwJyKYAH+k0DR0hfufXOgupB3yHad4w7PXIm/ktgF5DEWQaRAYIyQbAr7bfcqwcdBJXM58mo9IQbcGyQmUBsprS LP4M7swqWhZlZySWsse1ytQraDYUV7N0SK5H91DJJaV0GpO1mh g1RjYx+ugwQ/udpubZCk60Nxh6BpA2l1l7oP/MSG7A5tC7hrpfLgYrtzXx0I3M1SSX+TJ3fRMZEY9XjKwYf4fwI XxifnIew7tO2UvKvSYT83/2CT8HANkwxatjPQFFSan9W9vlly7mEHzxZ7rzIrKz0pZnn0Q9b ok3f0ouDwG0gclwDINJSiFPpM1M5qS+cC3fqrQ5DQsoEn1cyWQ 8a9UirU4Wg+w8ndTI/d+bvnZSvcgUO0MwOisuZt8X3EgGqkl2aYJzttAPkH5eH6WH9pE 2pykli4gxCSw4XUk4k5Yp" />
</div>

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>


<div>

    <input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" />
    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="phDWK8oHIXHcuc2IX2D4wk51uT/TMgzCNYduhoQs9seZ6xNsAFhks/fFaRf7PH3cXyrxFzL33767YI9/iEA+G5dFKm1hp0zO3ueiLZW02qY=" />
</div>
    <div>

    <select name="ctl00$ContentPlaceHolder1$DropDownList1" onchange="javascript:setTimeout('__doPostBack(\'ct l00$ContentPlaceHolder1$DropDownList1\',\'\')', 0)" id="ctl00_ContentPlaceHolder1_DropDownList1">
    <option value="1">Mellingham-16 Oct 04</option>
    <option value="2">Fulchester Rovers-31 Oct 04</option>
    <option value="3">Wilstone Wanderers-06 Nov 04</option>
    <option value="4">Wilstone Wanderers-14 Nov 04</option>
    <option selected="selected" value="5">Whetwang Wallabies-21 Nov 04</option>
    <option value="6">Clatterham Town-28 Nov 04</option>
    <option value="7">Ponsonby Athetic-05 Dec 04</option>
    <option value="8">Buychester United-12 Dec 04</option>
    <option value="9">Mellingham-19 Dec 04</option>

</select>
    <br />
    </div>
    </form>
</body>
</html>


  #9 (permalink)  
Old December 6th, 2008, 12:56 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,044
Thanks: 80
Thanked 1,580 Times in 1,557 Posts
Default

Broken record, broken record......

Did you check the errata?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
  #10 (permalink)  
Old December 6th, 2008, 01:07 PM
Authorized User
 
Join Date: Dec 2008
Location: , , Greece.
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via MSN to fh84
Default

Yes I did. There are records on the table. I do exactly what the book says. Even the end code does not work. Listen, the book I read Beginning ASP.NET 2.0 with C# and the end code is available on this side. Why, wouldn't have a look about it?
It would be easier for you to find out the problem. The problem is on chapter 7.
Please help me I need this part of the code for my project!!!
Thank you very much for your help.






 


Thread Tools
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
Login page problem mashour BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 November 18th, 2008 05:25 PM
Problem with Chapter 2 First Page xtiano77 ASP.NET 3.5 Basics 1 May 7th, 2008 02:00 AM
page jump problem netmastan Ajax 0 April 11th, 2007 05:55 PM
Page Layout Problem Spades Dreamweaver (all versions) 1 December 2nd, 2004 04:55 PM
Page Hits Problem eddiema Classic ASP Professional 3 October 10th, 2003 01:46 PM



All times are GMT -4. The time now is 06:30 PM.


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