Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 





Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read

Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
Thread Tools
Old 07-24-2008, 01:50 PM   #1 (permalink)
Registered User
 
Join Date: May 2008
Posts: 12
OS: Windows XP


Mailto link from database field

Hello,

I am trying to use the mailto function to pull in the email address from a SQL table and I don't know what I am missing as far as the syntax and coding. Here is what I have:

<a href="mailto:dr["Email"] ">" + dr["Email"] .ToString() + "</a>

Thanks
bootsy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 07-24-2008, 02:21 PM   #2 (permalink)
Fox
TSF Enthusiast
 
Fox's Avatar
 
Join Date: Sep 2002
Location: NJ
Posts: 7,752
OS: XP Pro, CentOS

My System

Send a message via ICQ to Fox Send a message via AIM to Fox Send a message via MSN to Fox Send a message via Yahoo to Fox Send a message via Skype™ to Fox
Re: Mailto link from database field

What preprocessor are you using? Where is the rest of your source?
__________________
Antec Neo Power 500W, ABIT IP35-E, Intel E2180@2.66Ghz, Corsair XMS2 2x1GB DDR2-800, PNY 8800GT, 320GB Seagate

* lazy college student alert *- If I've inadvertently ignored a thread, please Let me know about it

Have I helped you solve your problem?
Donate to Techsupportforums

Klart Skepp!
Fox is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 07-24-2008, 02:25 PM   #3 (permalink)
Registered User
 
Join Date: May 2008
Posts: 12
OS: Windows XP


Re: Mailto link from database field

Quote:
Originally Posted by Fox View Post
What preprocessor are you using? Where is the rest of your source?
Here is the entire code:

Code:
using System.Web.UI.HtmlControls;

namespace HSI
{
public partial class ourpeople_workercomp : System.Web.UI.Page
{
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadWC();
         }

        private void LoadWC()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            DataTable dt = Utils.GetDataTableForUI("dbo.WorkersCompEmpSEL", null);

            foreach (DataRow dr in dt.Rows)
            {


                sb.Append("<li>" + dr["EmployeeName"]     .ToString() + ",&nbsp;" + dr["EmployeeTitle"]     .ToString() + "<br>" + dr["Phone"]     .ToString() + "<br>" + dr["Email"]     .ToString() + "<br>" + dr["Location"]     .ToString() + "</li>");
              
            }
                      

            this.workersUL.InnerHtml = sb.ToString();
        }


      
        }
    }
bootsy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 07-24-2008, 07:07 PM   #4 (permalink)
Fox
TSF Enthusiast
 
Fox's Avatar
 
Join Date: Sep 2002
Location: NJ
Posts: 7,752
OS: XP Pro, CentOS

My System

Send a message via ICQ to Fox Send a message via AIM to Fox Send a message via MSN to Fox Send a message via Yahoo to Fox Send a message via Skype™ to Fox
Re: Mailto link from database field

Ah, ok, I'm not a .net or ASP guy, but perhaps you need to concatenate the email address variable with the beginning of the tag. What output do you get with the way you have it currently?
__________________
Antec Neo Power 500W, ABIT IP35-E, Intel E2180@2.66Ghz, Corsair XMS2 2x1GB DDR2-800, PNY 8800GT, 320GB Seagate

* lazy college student alert *- If I've inadvertently ignored a thread, please Let me know about it

Have I helped you solve your problem?
Donate to Techsupportforums

Klart Skepp!
Fox is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 07-25-2008, 07:09 AM   #5 (permalink)
Registered User
 
Join Date: May 2008
Posts: 12
OS: Windows XP


Re: Mailto link from database field

What I get now on the page is I get a link and when you hover over it at the bottom right corner of the browser it says mailto:dr[. When you click on the link it opens a new message email and in the To field it says dr[.
bootsy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 07-25-2008, 07:43 AM   #6 (permalink)
Fox
TSF Enthusiast
 
Fox's Avatar
 
Join Date: Sep 2002
Location: NJ
Posts: 7,752
OS: XP Pro, CentOS

My System

Send a message via ICQ to Fox Send a message via AIM to Fox Send a message via MSN to Fox Send a message via Yahoo to Fox Send a message via Skype™ to Fox
Re: Mailto link from database field

Yup, that's because you haven't enclosed the variable.

You should try changing this :

Code:
<a href="mailto:dr["Email"]     ">" + dr["Email"]     .ToString() + "</a>
To this:

Code:
<a href="mailto:"+dr["Email"]    +">"+dr["Email"]    .ToString()+"</a>
I'm not sure how you have this in your display page (the code quote was for the behind-the-scenes stuff, right?), but I think that's basically how it needs to change in order to work.

Let me know if you have success with this.
__________________
Antec Neo Power 500W, ABIT IP35-E, Intel E2180@2.66Ghz, Corsair XMS2 2x1GB DDR2-800, PNY 8800GT, 320GB Seagate

* lazy college student alert *- If I've inadvertently ignored a thread, please Let me know about it

Have I helped you solve your problem?
Donate to Techsupportforums

Klart Skepp!
Fox is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 07-25-2008, 08:49 AM   #7 (permalink)
Registered User
 
Join Date: May 2008
Posts: 12
OS: Windows XP


Re: Mailto link from database field

I think we are closer but what happens now when I use your updated code is that the a href seems to be missing something. The quotes between the open tag of the a href and closing tags don't match up. This is what I have right now.

"<br>"<a href="mailto:"+dr["Email"] +">"+dr["Email"] .ToString()+"</a><br>"

Something seems to be missing in this code.
bootsy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 07-25-2008, 09:12 AM   #8 (permalink)
Registered User
 
Join Date: May 2008
Posts: 12
OS: Windows XP


Re: Mailto link from database field

I figured it out. The code should look like this:

"<br><a href='mailto:" + dr["Email"] .ToString() + "'>" + dr["Email"] .ToString()

Fox, thanks for your help on this. I appreciate it.
bootsy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 07-25-2008, 09:15 AM   #9 (permalink)
Fox
TSF Enthusiast
 
Fox's Avatar
 
Join Date: Sep 2002
Location: NJ
Posts: 7,752
OS: XP Pro, CentOS

My System

Send a message via ICQ to Fox Send a message via AIM to Fox Send a message via MSN to Fox Send a message via Yahoo to Fox Send a message via Skype™ to Fox
Re: Mailto link from database field

Ah, ok, I think you are missing some quotation marks. You'll need to escape some of them. I do not know how to do it for this language (this is asp, right?), but I would expect it's a \ or something. Also, the " between <br> and <a href seems like it's extraneous.

If the escaped characters work with a slash, it might look something like this:

Code:
"<br><a href=\"mailto:\""+dr["Email"]   +"\">"+dr["Email"]   .ToString()+"</a><br>"
I know it looks sort of ugly, but it's necessary in order to tell the server which quotations are ending strings for processing, and which ones are going to be sent out into the processed HTML.
__________________
Antec Neo Power 500W, ABIT IP35-E, Intel E2180@2.66Ghz, Corsair XMS2 2x1GB DDR2-800, PNY 8800GT, 320GB Seagate

* lazy college student alert *- If I've inadvertently ignored a thread, please Let me know about it

Have I helped you solve your problem?
Donate to Techsupportforums

Klart Skepp!
Fox is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -7. The time now is 04:05 PM.



Copyright 2001 - 2008, Tech Support Forum

Search Engine Friendly URLs by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82