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. how to call javascript function from ascx page??

how to call javascript function from ascx page??

Scheduled Pinned Locked Moved ASP.NET
javascripttutorialquestion
2 Posts 2 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.
  • S Offline
    S Offline
    sarala s
    wrote on last edited by
    #1

    Hi friends, i am fine and hope u so... I am having commom.js file which contains all the validations.... i like to call one of the function from ascx page while i am clicking the button in ascx page....for validation.... i have tried with Page.RegisterClientScriptBlock,but i couldn;t..can anyone explain the way to do it?? thanks in advance... sarala.s

    D 1 Reply Last reply
    0
    • S sarala s

      Hi friends, i am fine and hope u so... I am having commom.js file which contains all the validations.... i like to call one of the function from ascx page while i am clicking the button in ascx page....for validation.... i have tried with Page.RegisterClientScriptBlock,but i couldn;t..can anyone explain the way to do it?? thanks in advance... sarala.s

      D Offline
      D Offline
      Dinesh Mani
      wrote on last edited by
      #2

      When you add a user control to a aspx page the client id of the normal ASP.NET controls that you have used in the user control are different from the normal ones. Your javascript function need to find the control by its new control name and then validate it. You can do it by either passing the control's client id to the javascript when you register the javascript call, or view the source to get the client id and then hard code it in the javascript function. The first method is better and allows you to use the same validation function across all pages with multiple instances of the user control.

      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