Wrox Programmer Forums
|
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 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 August 11th, 2011, 03:18 PM
Registered User
 
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>
 
Old August 26th, 2011, 10:45 PM
Wrox Author
 
Join Date: Mar 2006
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
The Following User Says Thank You to bnews987 For This Useful Post:
keithwolma (September 7th, 2011)





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





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