Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 17th, 2004, 11:28 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Raif
Default Token error using process.start

hi, I am trying to create a link for ones email address where you click the address and it open up the users default email client (outlook or whatever ). So I declare my process as a process and then do myprocess.start("mailto:") and I get an error that says. "An attempt was made to reference a token that does not exist ". Ultimatly I want to append an email address to the end of the mailto: , which I have tried but I get the same error so I'm simplifying till I get it working.

my html looks like
<code> <asp:linkbutton id="linkemail" Font-Size="10" CommandName ="EmailButton" Commandargument = '<%#databinder.eval(container.dataitem, "email")%>' text='<%#databinder.eval(container.dataitem, "email")%>' Runat="server" width="100"></asp:linkbutton> </code>

and again my vb looks like
  Dim myprocess As Process = New Process
            myprocess.Start("mailto:")

(I have cut out the cammandarguments till I can get at least a hardcoded email to work )
I also tried using a <asp:hyperlink> with the url as "mailto:" and this opens up the client but I need to have a non hardcoded value for the email address and it doesn't want to take any concantination with the mailto:

Any help is greatly appreaciated
Thanks
Raif


  #2 (permalink)  
Old August 17th, 2004, 12:35 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I think you are severely overcomplicating this:

A) Your VB code is running on the server, not the client. So you can't launch an application on the client by means of server-side code.

B) All you need to do is a simple <a> tag or hyperlink object (you just need to concatenate in the right place):

<asp:hyperlink id="linkemail" navigateurl='<%# String.Format("mailto:{0}", databinder.eval(container.dataitem, "email"))%>' text='<%#databinder.eval(container.dataitem, "email")%>' Runat="server" />
  #3 (permalink)  
Old August 17th, 2004, 12:47 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Raif
Default

Awesome. Indeed I did overcomplicate it. However, for my edification could you please explain part of it for me? Specificaly

'<%# String.Format("mailto:{0}", databinder.eval(container.dataitem, "email"))%>'

so I guess the string.format concatinates the values of whatever objects are in the () and returns a string. so if that part is right the next question is what is the {0} with in quotes do/mean. I have seen it before and just sort of hoped it would go away but obviously I need to embrace it.

Thanks for the solution and thanks for the explanation
Raif

  #4 (permalink)  
Old August 17th, 2004, 08:42 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

{0} is the replacement token for String.Format. The basic forms of that method are:
String.Format(formatstring, object)
String.Format(formatstring, object, object)
String.Format(formatstring, object, object, object)

For each, you use {0}, {1} and {2} for the three possible replacement tokens. That way you can construct strings from fixed strings and variables without the need for the typical (old style) concatenation: "..." & strVar & "..."
It's more efficient and much easier to read and write.

You can expand the format's to actually format the input:

   String.Format("I made ${0:#,###.00} this year.", 3)

This would give you "I made $3.00 this year."
 


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
xpath contains error 'has an invalid token' XMLUser XSLT 7 February 5th, 2008 02:31 AM
store and process error messages Hylsan PHP Databases 7 December 20th, 2006 08:40 AM
error LNK2020 unresolved token rachappa Visual C++ 1 January 12th, 2006 08:05 AM
Can't get past "Token StartElement" error Colonel Angus Classic ASP XML 1 August 10th, 2005 01:21 PM
file error ...being used by another process rreynolds Pro VB.NET 2002/2003 6 January 11th, 2005 11:56 AM



All times are GMT -4. The time now is 02:11 PM.


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