Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7
This is the forum to discuss the Wrox book Beginning Microsoft Visual Basic 2008 by Thearon Willis, Bryan Newsome; ISBN: 9780470191347
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 11th, 2011, 03:18 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2011
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Default Sample code not working Chapter 18

I built the sample web app for chapter 18 and html side does not give any errors, but does not work either. See page 624 for start of ASP.NET Try it out.

Note, I started out using VB 2003 .NET and when I found too many things missing to do the course, picked up Visual Studio 2010 Ultimate and am working with that. Some items have changed in selection and may be the issue.

I am including two copies. The first is from building a blank web page ("ASP.NET Empty Web Application") after the default web page did not work properly. The second is using "ASP.NET Web Application"

The blank seemed to more closely match your syntax.

thanks
Keith

Build from blank web page
================================================== =====
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="Client_Server_Processing2._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>"My Web Page"</title>
<script language="javascript" type="text/javascript">
// <![CDATA[

function btnClient_onclick() {
document.getElementById("lblServer").innerHTML = "Server";
document.getElementById("lblClient").innerHTML = "Changed";
}

// ]]>
</script>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Button ID="btnServer" runat="server" Text="Server" />
<asp:Literal ID="lblServer" runat="server" Text="Server"></asp:Literal>

</div>
<p>
<input id="btnClient" type="button" value="Client" onclick="return btnClient_onclick()" /><asp:Label ID="lblClient"
runat="server" Text="Client"></asp:Label>
</p>
</form>
</body>
</html>
================================================== ====

Build from default web page
================================================== ====
<%@ Page Title="My Web Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="Default.aspx.vb" Inherits="Client_Server_Processing._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<p>
<script language="javascript" type="text/javascript">

// <![CDATA[

function btnClient_onclick() {
document.getElementById("lblClient").innnerHTML = "Changed";
document.getElementById("lblServer").innnerHTML = "Server";
}

// ]]>
</script>
<br />
<asp:Button ID="btnServer" runat="server" Text="Server" />
<asp:Label ID="lblServer" runat="server" Text="Server"></asp:Label>
</p>
<p>
<input id="btnClient" type="button" value="Client" onclick="return btnClient_onclick()" /><asp:Label ID="lblClient"
runat="server" Text="Client"></asp:Label>
</p>
<p>
&nbsp;</p>
</asp:Content>
Reply With Quote
  #2 (permalink)  
Old August 26th, 2011, 10:45 PM
Wrox Author
Points: 333, Level: 6
Points: 333, Level: 6 Points: 333, Level: 6 Points: 333, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2006
Location: , , .
Posts: 91
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Hi Keithwolma,

I created an empty website in 2010 and the following code works for the client side.

Code:
<%@PageLanguage="vb"AutoEventWireup="false"CodeBehind="WebForm1.aspx.vb"Inherits="WebApplication3.WebForm1" %>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headid="Head1"runat="server">
<title>"My Web Page"</title>
<scriptlanguage="javascript"type="text/javascript">
// <![CDATA[
function btnClient_onclick() {
document.getElementById("lblServer").innerHTML = "Server";
document.getElementById("lblClient").innerHTML = "Changed";
}
// ]]> 
</script>
</head>
<body>
<formid="form1"runat="server">
<p>
<asp:ButtonID="btnServer"runat="server"Text="Server"/>
<asp:LabelID="lblServer"runat="server"Text="Label"ClientIDMode="Static"></asp:Label>
</p>
<p>
<inputid="btnClient"type="button"value="Client"onclick="return btnClient_onclick()"/>
<asp:LabelID="lblClient"runat="server"Text="Client"ClientIDMode="Static"></asp:Label>
</p>
</form>
</body>
</html>


Just change your literal to a label and you should be good.

Thanks,

Bryan
Reply With Quote
The Following User Says Thank You to bnews987 For This Useful Post:
keithwolma (September 7th, 2011)
Reply


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
Getting sample code working with VWDE 2008 john77 BOOK: ASP.NET 3.5 Website Programming Problem Design Solution 0 November 4th, 2009 04:03 PM
chapter 18 webwork example not working resolutions BOOK: Beginning JavaServer Pages 2 November 1st, 2005 11:25 PM
CHAPTER 18 example not working also! diegoborgh BOOK: Beginning JavaServer Pages 0 May 26th, 2005 11:16 PM
Chapter 18-Sample App-Compilation pdtt JSP Basics 5 December 12th, 2004 10:40 PM



All times are GMT -4. The time now is 05:19 PM.


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