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. cant refer javascript variable in c# method

cant refer javascript variable in c# method

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptdatabasetoolsquestion
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
    sabby2006
    wrote on last edited by
    #1

    Hi I have a variable in javascript and in the aspx file i have written the code like this objhidquestions.value= objSelectedQuestion ; var abc='<%=Utility.TripleDesEncrypt("' + objhidquestions.value + '")%>' var url= "../popUp/ViewQuestion.aspx?id=" + abc ; when i get the value of the query string of objhidquestions.value is not there instead in get the name of the object as "objhidquestions.value" Please

    Regards

    C 1 Reply Last reply
    0
    • S sabby2006

      Hi I have a variable in javascript and in the aspx file i have written the code like this objhidquestions.value= objSelectedQuestion ; var abc='<%=Utility.TripleDesEncrypt("' + objhidquestions.value + '")%>' var url= "../popUp/ViewQuestion.aspx?id=" + abc ; when i get the value of the query string of objhidquestions.value is not there instead in get the name of the object as "objhidquestions.value" Please

      Regards

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Well, of course. I recommend buying a book on ASP.NET, you plainly are very confused about how it works. Javascript runs on the browser, it is not C#, and does not run on the server. You've put + objhidquestions.value + in quotes, and therefore you will get these values verbatim. In fact, you are asking C# to evaluate the result of something that javascript has not yet been asked to create. The only way you could do this, if the value of objSelectedQuestion changes, is with AJAX.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      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