Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 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 1st, 2006, 01:30 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I just ran another test in the converter, and it seems that "Handles Me.Load" is causing the problem.

Removing that allowed me to successfully convert one page...

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 2nd, 2006, 03:38 PM
Authorized User
 
Join Date: Jul 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jsantamaria
Default

Thank you Imar. Removing the "Handles Me.Load" did it!!! Now, If I could only figure out the Default.aspx.cs error I'm getting:

Code:
Compiler Error Message: CS0136: A local variable named 'drChatRoom' cannot be declared in 
this scope because it would give a different meaning to 'drChatRoom', which is already used 
in a 'parent or current' scope to denote something else

Source Error:

 

Line 23:             DataRow drChatRoom;
Line 24:             int lastCategoryID = 0;
Line 25:             foreach (int drChatRoom in dtChatRoom.Rows)
Line 26:             {
Line 27:                 int CategoryId = dtChatRoom.Rows(currentRow).Item("CatID").ToString();
Line 25 is the one throwing the error. Any takers?

Jose
 
Old August 2nd, 2006, 04:03 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Heuh? I was preparing an answer based on message alerts I got, but now when I wanted to post the answer, the questions are gone ... ;)


I am not sure if I am changing the intention, but this should work:

DataRow drChatRoom;
int lastCategoryID = 0;
foreach (drChatRoom in dtChatRoom.Rows)
{
  int CategoryId = dtChatRoom.Rows(currentRow).Item("CatID").ToString ();

(e.g. remove the int datatype for drChatRoom in the loop.)

Or:

int lastCategoryID = 0;
foreach (DataRow in dtChatRoom.Rows)
{
  int CategoryId = dtChatRoom.Rows(currentRow).Item("CatID").ToString ();


Besides this, I think

dtChatRoom.Rows(currentRow)

has to be

dtChatRoom.Rows[currentRow]

as it is an indexer, not a method....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 3rd, 2006, 08:33 AM
Authorized User
 
Join Date: Jul 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jsantamaria
Default

Imar,

Thanks for all the help. I tried your suggestions, but no I get the error:

"CS0230: Type and identifier are both required in a foreach statement"



Jose

 
Old August 3rd, 2006, 11:59 AM
Authorized User
 
Join Date: Jul 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jsantamaria
Default

Ok, so I "gave up" on the previous error, and I worked around it. Now, I get the chat room display but I get the following Javascript error at the bottom of my page:

Line: 16
Char: 5
Error: 'Object expected'
Code: 0
URL: http://domain/ChatWindow.aspx?ChatRoomID=1

My code in ChatWindow.aspx looks like this:

Code:
<%@ Page Language="C#" AutoEventWireup="false" CodeFile="ChatWindow.aspx.cs" Inherits="aftercare_ChatWindow" %>

<!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 id="Head1" runat="server">
        <title>Untitled Page</title>

<script type="text/javascript">

setInterval('refreshChatWindow();',2000);

function refreshChatWindow()
{
    CallServer('', null);     
} //This is line #16, where the error is showing
function ReceiveServerData(arg, context)
{
    //send the value to the html control...
    var obj = document.getElementById("divChatWindow");
    obj.innerHTML = arg;
    location.href = "#bottom";
}


    </script>
</head>

    <body title="Chat Window Area" bgcolor="#ffffcc">
        <form id="Form1" method="post" runat="server">
        <div id="divChatWindow"></div>
        </form>
    </body>
</html>
Any help is appreciated.

 
Old August 3rd, 2006, 04:18 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I think the previous error can be fixed with this:

foreach (DataRow drChatRoom in dtChatRoom.Rows)
{
  int CategoryId = dtChatRoom.Rows(currentRow).Item("CatID").ToString ();


The Javascript error seems to be about a missing CallServer function. Shouldn't you add that function, or include a file that contains it?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: You Could Be Mine by Guns N' Roses (Track 11 from the album: Use Your Illusion 2) What's This?
 
Old August 5th, 2006, 12:26 PM
Authorized User
 
Join Date: Jun 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by SeanKilleen
 Found an excellent little VB.NET to C# conversion tool:

http://www.elegancetech.com/CSVB.aspx

might be worth looking into.
Hmm... they only mention Visual Studio 2003 code, that's NET 1.0 and NET 1.1...

I think purchase is waste, there are free tools available online directly on websites. One of them is "Dot Net Taxi".


Regards
Carsten Berggreen
Monolith-Systems
Denmark





Similar Threads
Thread Thread Starter Forum Replies Last Post
what ASP.NET 2.0 in VB code book is best apro ASP.NET 2.0 Basics 8 December 22nd, 2007 12:40 PM
E-Book version, wih VB.NET code SoftMind BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 9 December 22nd, 2006 12:19 PM
FYI: Specify VB or C# book/code when posting jminatel BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 May 1st, 2006 07:42 PM
VB.Net code for the new book SoftMind BOOK: ASP.NET Website Programming Problem-Design-Solution 1 April 7th, 2006 07:28 AM





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