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. Accessing ASP.net control in [Ajax.JavascriptMethod()]

Accessing ASP.net control in [Ajax.JavascriptMethod()]

Scheduled Pinned Locked Moved ASP.NET
tutorialcsharpasp-nethelp
4 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.
  • R Offline
    R Offline
    raghu g
    wrote on last edited by
    #1

    Hi. On a button click i'm opening a page with showModalDialog, depending on the value returned from modal dialog, i want to clear contents of asp.net controls. These controls are read only controls. But i'm unable to clear the controls. Please guide me how to resolve this issue. Thanks in Advance.

    N 1 Reply Last reply
    0
    • R raghu g

      Hi. On a button click i'm opening a page with showModalDialog, depending on the value returned from modal dialog, i want to clear contents of asp.net controls. These controls are read only controls. But i'm unable to clear the controls. Please guide me how to resolve this issue. Thanks in Advance.

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Find the element on the page via JavaScript and clear it appropriately document.GetElementById("somecontrol").value = ""; of JQuery $("#somecontrol").val("");


      I know the language. I've read a book. - _Madmatt

      R 1 Reply Last reply
      0
      • N Not Active

        Find the element on the page via JavaScript and clear it appropriately document.GetElementById("somecontrol").value = ""; of JQuery $("#somecontrol").val("");


        I know the language. I've read a book. - _Madmatt

        R Offline
        R Offline
        raghu g
        wrote on last edited by
        #3

        Hi.Thanks for you reply. document.GetElementById("somecontrol").value = ""; this code is valid,but in my case i'm unable to do it, var URL = 'AddParticipant.aspx?Id='+EventId+'; retVal = showModalDialog(URL, false, "dialogHeight:700px;dialogWidth:900px;scroll:yes;"); I'm able to retrieve the value well. after that i wrote following document.getElementById("<%=txtOrderNo.ClientID%>;").value=""; But i'm unable to clear the content. and the textbox is readonly, and the page is in side updatepanel. Does it have anything to do.. Thanks again

        N 1 Reply Last reply
        0
        • R raghu g

          Hi.Thanks for you reply. document.GetElementById("somecontrol").value = ""; this code is valid,but in my case i'm unable to do it, var URL = 'AddParticipant.aspx?Id='+EventId+'; retVal = showModalDialog(URL, false, "dialogHeight:700px;dialogWidth:900px;scroll:yes;"); I'm able to retrieve the value well. after that i wrote following document.getElementById("<%=txtOrderNo.ClientID%>;").value=""; But i'm unable to clear the content. and the textbox is readonly, and the page is in side updatepanel. Does it have anything to do.. Thanks again

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Remove the semicolon after the binding expression document.getElementById("<%=txtOrderNo.ClientID%>;").value=""; it should be this document.getElementById("<%=txtOrderNo.ClientID%>").value=""; The former is adding the semicolon to the id which of course can't be found in the dom.


          I know the language. I've read a book. - _Madmatt

          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