www.webdeveloper.com
Results 1 to 3 of 3

Thread: Code Behind -> Javascript

  1. #1
    Join Date
    Apr 2003
    Posts
    8

    Code Behind -> Javascript

    Hi,

    Basically, I am trying to pass some information from my database (which I am accessing in my code behind) to a Iframe Edit Control in my HTML and Javascript code. How do I pass information between these?

    I know how to access the database no problem in the code behind, and how to put information into the Iframe Edit Control in my Javascript... but i dont know how to pass info between them. I presume its through a global variable or something?...

    <Script Language="javascript" for="DesktopText" event="onload">
    DesktopText.document.body.innerHTML = ''
    </Script>

    ...with putting my global variable (which i would fill from the database in my code behind) at the end of that line.

    CAN ANYONE HELP?

    I am using Visual Studio.net and im working in an .aspx.

    Cheers,
    Stu.

  2. #2
    Join Date
    Apr 2003
    Posts
    8

    Now... how to get it out again?

    Cheers,

    I have now actually got it kind of working for passing the data in... what i did was declare a public variable in my code behind, then filled it with the data, and then placed it in the IFRAME using <%= VARIABLENAME %> in HTML/JAVASCRIPT view.

    However, I dont know how to get it back out again... ie. I dont know how to refer to the IFRAME from the code behind?

    or alternatively I dont know how to fill a variable from the HTML/Javascript that can then be used in the code behind to populate the database.

    If it is not clear what i mean... basically I have now got my info in the IFRAME on screen and I want to save the contents to a database (the code for this is in my code behind).

    Any ideas how to do this?

    Stu.

  3. #3
    tim_gor is offline Disgruntled Office Worker
    Join Date
    Mar 2003
    Posts
    25
    Just a suggestion and this may be (and probably is!) irrelevant...

    How about using a <div id="PredefinedDIVName">DATA HTML(maybe even commented out using <!-- -->) </div>

    Then you can just access the data using PredefinedDIVName.innerHTML

    Don't know if this will work as your problem seems quite complex

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles