Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. why my javascript attribut dosent work in usercontrol ????

why my javascript attribut dosent work in usercontrol ????

Scheduled Pinned Locked Moved ASP.NET
questionjavascripthelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    elhameh
    wrote on last edited by
    #1

    I got following scenario: User control placed on default.aspx page, in my user control i got a text box and "Submit" button is on my user control. Now i need to add the validat my text box (which is in user control) when user clicks "Submit" button then i should show error message. I need to do my validation on client side I tried it by adding an attribut to my button like this : BtnSave.Attributes.Add("onclick", "if (!ValidateSecActionType()) return false; "); then i wrote this code in codefront page : function ValidateSecActionType() { if(document.getElementById('txtSecActionTypeTitle').innerText == "1" ) { document.getElementById('AlertLbl').style.visibility = 'visible' ; return false; } return true; } now when i run my page i have an error like this : Object Required how can i do this ????????????? thanks alot....

    G B 2 Replies Last reply
    0
    • E elhameh

      I got following scenario: User control placed on default.aspx page, in my user control i got a text box and "Submit" button is on my user control. Now i need to add the validat my text box (which is in user control) when user clicks "Submit" button then i should show error message. I need to do my validation on client side I tried it by adding an attribut to my button like this : BtnSave.Attributes.Add("onclick", "if (!ValidateSecActionType()) return false; "); then i wrote this code in codefront page : function ValidateSecActionType() { if(document.getElementById('txtSecActionTypeTitle').innerText == "1" ) { document.getElementById('AlertLbl').style.visibility = 'visible' ; return false; } return true; } now when i run my page i have an error like this : Object Required how can i do this ????????????? thanks alot....

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Could you share some more information about the error message, like when and where it occurs, and what code line it refers to? I don't know if this is the cause of the error, but: The innerText property is only available in Internet Explorer, and probably only in quirks mode. Use innerHTML instead.

      --- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams

      1 Reply Last reply
      0
      • E elhameh

        I got following scenario: User control placed on default.aspx page, in my user control i got a text box and "Submit" button is on my user control. Now i need to add the validat my text box (which is in user control) when user clicks "Submit" button then i should show error message. I need to do my validation on client side I tried it by adding an attribut to my button like this : BtnSave.Attributes.Add("onclick", "if (!ValidateSecActionType()) return false; "); then i wrote this code in codefront page : function ValidateSecActionType() { if(document.getElementById('txtSecActionTypeTitle').innerText == "1" ) { document.getElementById('AlertLbl').style.visibility = 'visible' ; return false; } return true; } now when i run my page i have an error like this : Object Required how can i do this ????????????? thanks alot....

        B Offline
        B Offline
        blue_arc
        wrote on last edited by
        #3

        go to view source, and check whether the, 'txtSecActionTypeTitle' is same or it is comming with some prefixfollowed with and underscore. eg: 'ctl00_txtSecActionTypeTitle'

        Ravi Kant Srivastava (System Analyst) HandsOn Technology & Engineering Gurgaon (India) e-mail:ravikant@hte.co.in

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups