There are two mistakes in Chapter 31, Using Server-Side ASP.NET AJAX, both related to a last minute change to the ListView control. Microsoft changed the ListView control to require an itemPlaceholder instead of an itemContainer element in its LayoutTemplate. I managed to update the other code samples related to the ListView control in the book, but I neglected to update Chapter 31 (I forgot that I used the ListView control in this chapter).
The correct code for Listing 31.6 is:
1: <%@ Page Language="C#" %>
2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3: <html xmlns="http://www.w3.org/1999/xhtml">
4: <head runat="server">
5: <title>Nested UpdatePanels</title>
6: <style type="text/css">
7: fieldset
8: {
9: padding: 10px;
10: }
11: .comment
12: {
13: padding: 10px;
14: border: dotted 2px black;
15: margin: 10px;
16: }
17: </style>
18: </head>
19: <body>
20: <form id="form1" runat="server">
21: <div>
22: <asp:ScriptManager
23: id="sm1"
24: Runat="server" />
25: Page Time: <%= DateTime.Now.ToString("T") %>
26: <br />
27: <asp:DropDownList
28: id="ddlMovie"
29: DataSourceID="srcMovies"
30: DataValueField="Id"
31: DataTextField="Title"
32: AutoPostBack="true"
33: Runat="server" />
34: <asp:SqlDataSource
35: id="srcMovies"
36: ConnectionString='<%$ ConnectionStrings:con %>'
37: SelectCommand="SELECT Id, Title FROM Movie"
38: Runat="server" />
39: <br /><br />
40: <asp:UpdatePanel ID="upOuter" UpdateMode="Conditional" runat="server">
41: <Triggers>
42: <asp:AsyncPostBackTrigger ControlID="ddlMovie" />
43: </Triggers>
44: <ContentTemplate>
45: Outer UpdatePanel Time: <%= DateTime.Now.ToString("T") %>
46: <br />
47: <asp:FormView
48: id="frmMovie"
49: DataSourceID="srcMovie"
50: Runat="server">
51: <ItemTemplate>
52: <fieldset>
53: <legend>Movie</legend>
54: Title: <%# Eval("Title") %>
55: <br />
56: Director: <%# Eval("Director") %>
57:
58: <asp:UpdatePanel ID="upInner" runat="server">
59: <ContentTemplate>
60: <asp:ListView
61: id="lstMovieComments"
62: DataSourceID="srcMovieComments"
63: InsertItemPosition="FirstItem"
64: Runat="server">
65: <LayoutTemplate>
66: <fieldset>
67: <legend>Comments</legend>
68: Inner UpdatePanel Time: <%# DateTime.Now.ToString("T") %>
69: <asp:PlaceHolder id="itemPlaceHolder" runat="server" />
70: </fieldset>
71: </LayoutTemplate>
72: <ItemTemplate>
73: <div class="comment">
74: <%# Eval("Comment") %>
75: </div>
76: </ItemTemplate>
77: <InsertItemTemplate>
78: <asp:Label
79: id="lblComment"
80: Text="Comment:"
81: AssociatedControlID="txtComment"
82: Runat="server" />
83: <br />
84: <asp:TextBox
85: id="txtComment"
86: Text='<%# Bind("Comment") %>'
87: TextMode="MultiLine"
88: Columns="40"
89: Rows="3"
90: Runat="server" />
91: <br />
92: <asp:Button
93: id="btnInsert"
94: Text="Add Comment"
95: CommandName="Insert"
96: Runat="server" />
97: </InsertItemTemplate>
98: </asp:ListView>
99: </ContentTemplate>
100: </asp:UpdatePanel>
101: <asp:SqlDataSource
102: id="srcMovieComments"
103: ConnectionString='<%$ ConnectionStrings:con %>'
104: SelectCommand="SELECT Id, Comment
105: FROM MovieComment
106: WHERE [email protected]"
107: InsertCommand="INSERT MovieComment (Comment,MovieId)
108: VALUES (@Comment,@MovieId)"
109: Runat="server">
110: <SelectParameters>
111: <asp:ControlParameter Name="MovieId" ControlID="ddlMovie" />
112: </SelectParameters>
113: <InsertParameters>
114: <asp:ControlParameter Name="MovieId" ControlID="ddlMovie" />
115: </InsertParameters>
116: </asp:SqlDataSource>
117: </fieldset>
118: </ItemTemplate>
119: </asp:FormView>
120: </ContentTemplate>
121: </asp:UpdatePanel>
122: <asp:SqlDataSource
123: id="srcMovie"
124: ConnectionString='<%$ ConnectionStrings:con %>'
125: SelectCommand="SELECT Id, Title, Director
126: FROM Movie
127: WHERE [email protected]"
128: Runat="server">
129: <SelectParameters>
130: <asp:ControlParameter Name="Id" ControlID="ddlMovie" />
131: </SelectParameters>
132: </asp:SqlDataSource>
133: </div>
134: </form>
135: </body>
136: </html>
Notice that I also updated the way that the current time is displayed for this code sample. I changed:
Inner UpdatePanel Time: <%= DateTime.Now.ToString(“T”) %>
To:
Inner UpdatePanel Time: <%# DateTime.Now.ToString(“T”) %>
The correct code for Listing 31.24 is:
1: <%@ Page Language="C#" %>
2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3: <html xmlns="http://www.w3.org/1999/xhtml">
4: <head runat="server">
5: <title>Timer Messages</title>
6: <style type="text/css">
7: .message
8: {
9: margin-left: 20px;
10: font-style:italic;
11: }
12: </style>
13: </head>
14: <body>
15: <form id="form1" runat="server">
16: <asp:ScriptManager ID="sm1" runat="server" />
17: <asp:Timer ID="Timer1" Interval="5000" runat="server" />
18: <asp:UpdatePanel ID="up1" runat="server">
19: <Triggers>
20: <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
21: </Triggers>
22: <ContentTemplate>
23: Last Refresh <%= DateTime.Now.ToString("T") %>
24: <hr />
25: <asp:ListView
26: id="lstMessages"
27: DataSourceID="srcMessages"
28: Runat="server">
29: <LayoutTemplate>
30: <asp:Placeholder id="itemPlaceholder" runat="server" />
31: </LayoutTemplate>
32: <ItemTemplate>
33: <div>
34: Posted by <%# Eval("PostedBy") %>
35: <div class="message">
36: <%# Eval("Post") %>
37: </div>
38: </div>
39: </ItemTemplate>
40: </asp:ListView>
41: </ContentTemplate>
42: </asp:UpdatePanel>
43: <asp:ObjectDataSource
44: id="srcMessages"
45: TypeName="Message"
46: SelectMethod="Select"
47: Runat="server" />
48: </form>
49: </body>
50: </html>
Thank you Nikolay for pointing out these errors.
Hi Stephen,
I have your book and found it usefull.
Unfortunatelly there are some errors on the book code. You’re doing a great job to fixing them but It will be more usefull to publish complete fixed sources as zip somewhere here or on Superexpert site. This will allow us to get the latest version without doing merge.
Thanks,
John
Just thought I would also comment on how much your book has helped me. Although I still haven’t made the move to C# from VB.NET your book has helped me no end.. thanks
Sir, I have found your book very useful.I am a ASP.NET/C# developer. I need ASP.NET 2.0 Shopping Cart sample application code sample. You can email me at [email protected]
Sir,I’m chinese reader,I have found your book very useful.I need ASP.NET 2.0 Unleashed code sample.but I can’t find them at this WebSite. Please email me the code at [email protected]
or [email protected]
Where is the code samples which in ASP.Net 3.5 unleashed book were written in both c# and visual basic.net??? i can’t find in this website…
Sir, Your book is very good and very well written. Thank you for it.
I want to ask you a question: could you please, send me the source code of the examples?
Thank you a lot.
Manuela
Where I can find the Visual Basic Example because i dont have the cd can email for me the answer [email protected]
Is your write-up still correct as of the Beta 1 release?
Hi,
unfortunatly, i lost the source code CD of ASP.Net Unleashed (2nd Edition). can you help me find out from where i can find source code.
i will really appriciate that.
Many thanks,
You can get syntax highlighting with this plugin:
f3q3 I tried to mock a call to a Linq to SQL query, but I am struggling.
You can get syntax highlighting with this plugin: i like this.
extrange blog but anyway
Useful, helpful and clearly understandable, the book you provided its just great, thanks
wow.. keep working like this.. thanks!!!
i was looking for a good tutorial on asp.NET. Really this book is nice and well descriptive.
Hello viagra its so good it give me hours of a strong erection
Hello
Thanks for the tutorial
Great job !!
nice tip, this is really good
Great tricks Stephen.
You can get syntax highlighting with this plugin which i love it!
Most of us have suffered from foot perspiration and odour from time to time, yet for some people, sweaty feet are a persistent problem which can be embarrassing and uncomfortable
I check your posts more often! Really interesting articles.I enjoyed reading it. I need to read more on this topic..Thanks for sharing a nice info…
Custom Logo Design | animated logos | Website logo design
Stationery Logo Design | brochure logo design
Nice article, very helpful. Thanks!—
Nike ,Jodon ,kappa shoes are selling on the way..Come on
…………….Nike shoes ! Addidas ! crazy buying ——————– Nike Shoes || air yeezy
f3434 It looks like DataContextExtensions.cs line 45 of the Save method should pass the primaryKeyName through to Update.
I am very glad to see such information which I was searching for a long time.This made very glad..This site has given us an useful information.
Fantastic walk-through. I appreciate this post.There is obviously a lot to know about this. I think you made some good points in Feature also
Very interesting post..Iam very much enjoyed by reading your site..this article has provided a useful info..Thanks for the info given..
Real Estate Logo | IT Logo | Financial Logo
Medical Logo | Construction Logos
selam hi This sounds fascinating sıcak sohbet I’m going to read that tracing articlekısa aşk şiirleri when I have a moment.
Wow. erotik film izle is
şifalı bitkiler zayıflama de
çet sohbet fer
netlog ger
müzik dinle err
şarkı dinle
cüneyt arkın filmleri kk
isyan sözleri fer
hikayeler er
islami çet ff
adet sancısına ne iyi gelir hh
escort bayanlar der
bedava chat dd
chat odaları der
liseli kızlar derf
kızlarla sohbet fder
kızlarla chat
sohbet errCXZ
You’re doing a great job to fixing them but It will be more usefull to publish complete fixed sources as zip somewhere here or on Superexpert site. This will allow us to get the latest version without doing merge.
toronto swingers club |toronto web design |toronto web hosting
Thanks for sharing info. Keep up the good work..we hope you will visit our blog often as we discuss topics of interest to you