Results 1 to 8 of 8

Thread: A simple problem. Please help

  1. #1

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    Exclamation A simple problem. Please help

    I am making a Contact page for a website using ASP.NET. In my aspx file there are a few textboxes. When I try to refer to these textboxes in script by their id's, it says that they are not declared. What am I doing wrong and how can I get this script to work?

    VB Code:
    1. dim Mname as string
    2. dim Mphone as string
    3. dim Memail as string
    4. dim Mmessage as string
    5.  
    6. Public Sub Post
    7.  
    8. 'There are textboxes on the form with the id's Name, Email, Phone and Message
    9. 'Here I need to Say that Mname = Name.text... excetera. But it doesnt work
    10.  
    11. Nname = Name.text
    12.  
    13.  
    14. ' Build a MailMessage
    15. Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
    16. mailMessage.From = "[email protected]"
    17. mailMessage.To = "[email protected]"
    18. mailMessage.Subject = "Contact Form Results"
    19. mailMessage.BodyFormat = System.Web.Mail.MailFormat.Html
    20. mailmessage.Body  = Mmessage
    21.  
    22. ' TODO: Set the mailMessage.Body property
    23.  
    24. System.Web.Mail.SmtpMail.SmtpServer = "localhost"
    25. System.Web.Mail.SmtpMail.Send(mailMessage)
    26.  
    27.  
    28.  
    29. end sub

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: A simple problem. Please help

    Name might be a reserved keyword, so either change its ID in your HTML to something like username. Or, try placing [square brackets] around Name.

  3. #3

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    Re: A simple problem. Please help

    Thanks for you help....

    I tried what you said but it still says that name is not declared even though its an id in the html of the page

    I tried using brackets and changing name to somthing else but it still wouldnt work

    how do i get it to declare right?
    Last edited by Latin4567; Mar 26th, 2005 at 12:13 PM.

  4. #4

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    Re: A simple problem. Please help

    I kinda need help as soon as possible so could someone please respond

    thx

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: A simple problem. Please help

    This may sound like a strange solution, but try this:

    Change the id of the element to "whatever".
    Switch to designer view, save the document.
    Build your project.
    Go to the codebehind, and see if it shows up in intellisense.

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: A simple problem. Please help

    If that don't work, delete the item and place it on the form again.

  7. #7

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    Re: A simple problem. Please help

    I am using the ASP.NET webmatrix so there isnt any intellisense... but I tried what you said. It turns out that none of my id's work... no matter what I call them

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: A simple problem. Please help

    Post all your ASPX code, highlight the relevant part.
    Post the codebehind too, highlight the relevant part.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width