Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 April 18th, 2005, 02:06 AM
Authorized User
 
Join Date: Jul 2004
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default Expected ')'


Hi..

Have tried everything to tackle this error.
But still it persists! Someone please help
me get rid of this!

I get the error - Expected ')' on this line:

Response.Write("<a href=# onclick=javascript:window.open('http://" & Global.ServerName & Global.VDirName & "/frmAAA.aspx?customer=" & System.Web.HttpUtility.UrlEncode(Replace(Replace(C ustomerName, "(", "@@"), ")", "##")) & "','snew','width=800,height=500,scrollbars=yes,too lbar=no,status=no,menubar=no,location=no')>")

CustomerName takes the value : AA for $19.25 ($9.755) - AA

PLease help!

Regards,
Spacy.



 
Old April 18th, 2005, 07:09 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

1. A better way of doing string concatenation is to use a System.Text.StringBuilder or use String.Format.
2. Use the system objects in their 'objective' manner. I.E. Instead of "Replace(x,y,z)" use "x.Replace(y,z)". Then it's easier to read multiple replaces:
"x.Replace(y,z).Replace(a,b)"
3. Try to use quotes on all your HTML attributes.
4. In .NET, the "~" character can be used to represent the complete application root directory. For a web application running under the "myWebApp/" virtual directory, using a url like this "~/myfolder/mypage.aspx" will yield "/myWebApp/myfolder/mypage.aspx". Use the "ResolveUrl()" method of the System.Web.UI.Page class to do the replacement of ~.

Often times I'll first create the output string with the String.Format replacement tokens in it. Then I run it thru String.Format to get all the stuff added in. This usually makes it much easier to see where the error is occuring.

Code:
Dim strHtml As String
strHtml = "<a href=""#"" onclick=""javascript:window.open('{0}?customer={1}','snew','width=800,height=500,scrollbars=yes,toolbar=no,status=no,menubar=no,location=no')"">"
strHtml = String.Format(strHtml, ResolveUrl("~/frmAAA.aspx"), System.Web.HttpUtility.UrlEncode(CustomerName.Replace("(", "@@").Replace(")", "##")))
-Peter
 
Old April 18th, 2005, 07:17 AM
Authorized User
 
Join Date: Jul 2004
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lotttt Peter!
The information you provided has added to my knowledge.
Didnt have much idea as am a beginner in .net
Will try your solution tomorrow. Its time to go home :)


Cheers..
Spacy...


Cheers..
Spacy...

 
Old April 20th, 2005, 07:17 AM
Authorized User
 
Join Date: Jul 2004
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Am i missing out something? I get the same error on trying this:

strHtml = "<a href=""#"" onclick=""javascript:window.open('{0}?customer={1} ','','width=800,height=500,scrollbars=yes,toolbar= no,status=no,menubar=no,location=no');"">"
strHtml = String.Format(strHtml, ResolveUrl("~/frmAAA.aspx"), strCustName.Replace("(", "@@").Replace(")", "##"))
Response.Write(strHtml)

I have noted that this error has nothing to do with the value passed in querystring.
Please help me. Am going nuts trying to solve this.

Regards,
Spacy.





 
Old April 20th, 2005, 08:28 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

This is a client side error we are talking about right?
What does the resulting HTML look like?
Why are you using Response.Write? This is not the preferred way of getting text out to the page.
 
Old April 20th, 2005, 11:02 PM
Authorized User
 
Join Date: Jul 2004
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, its a client side error and it is displayed just
before the output is flushed onto the screen. i.e as soon
as i click on OK of error message, the output is displayed.
The page (link) works properly, despite the error.
I dont get this error if i comment out the link part (<a href....)

The resulting HTML is a table report which displays the customer
names and balance against the different companies selected.

My boss was against using a Datagrid..so building a html table
using response.write was the only solution i could think of.

Thanks for being there, Peter. I really appreciate your help.

Thanks,
Spacy





 
Old April 20th, 2005, 11:30 PM
Authorized User
 
Join Date: Jul 2004
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is a part of the code:

  For row = 0 To drCompDetails.Length - 1
     strCustName = drCompDetails(row)("csname").ToString

     Response.Write("<tr><td>" & strCustName & "</td>")
     Response.Write("<td align=right>")
     strHtml = "<a href=""#"" onclick=""javascript:window.open('{0}?customer={1} ','','width=800,height=500,scrollbars=yes,toolbar= no,status=no,menubar=no,location=no');"">"
     strHtml = String.Format(strHtml, ResolveUrl("~/frmAccountHistory.aspx"), strCustName.Replace("(", "@@").Replace(")", "##"))
     Response.Write(strHtml) '''no error if this line is commented
     Response.Write(String.Format("{0:#,##0}", TotalBalance) & "</a></td></tr>")
  Next

The error is displayed only once, though the statement which fires it is inside
the loop. So i figured out that possibly the error is thrown for the
customer : AA for $19.25 ($9.755) - AA

 
Old April 21st, 2005, 05:22 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

If you dont want to use datagrid, why dont you try it out using Repeater insted. The way you have coded is very old which was used during the time of ASP. ASP.Net has lots of new features and I think you should use them.

Regards
Ganesh
 
Old April 21st, 2005, 05:39 AM
Authorized User
 
Join Date: Jul 2004
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I too agree with you. But my boss seems to have
some allergy towards using controls like
datagrid, repeater, etc.

 
Old April 21st, 2005, 08:37 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

<rant>
Does your boss have any clue about web technology???
Do they not realize that web controls do nothing but generate and render HTML which is no different than what you are doing manually?

Perhaps you should inform your boss that their decision to not let you use the built in controls will cost the company time and money. That decision is equivelant to buying a car and making you push it instead of drive it. If they don't want you to use what ASP.NET provides why even bother to use ASP.NET?
</rant>

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
expected Then Adam H-W Classic ASP Basics 6 April 17th, 2008 05:41 AM
expected ';' RoniR Javascript 3 February 1st, 2007 05:28 AM
Object Expected!! Apocolypse2005 Javascript 0 July 3rd, 2006 12:23 PM
too few parameters expected n desprate Access VBA 6 April 29th, 2005 06:33 AM
Expected 'Then' Adam H-W Classic ASP Basics 5 July 26th, 2004 02:36 PM





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