Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Passing a value to an INCLUDE page

    <font color=4682b4>PROBLEM SOLVED. Used Cookies to pass the data. Now it worketh.</font color=4682b4>

    This doesn't seem to want to work. I have a page for generating HTML bases on a db query and need to call up the page as an INCLUDE to get it to display properly in my webform. Is it in fact possible to pass a variable to an INCLUDE page? the statement

    < !--#INCLUDE FILE="Intake_Research.asp?EditedProviderID=10"-- >

    Doesn't work as the server is trying to find a file named <font face="Georgia">Intake_Research.asp?EditedProviderI D=10</font face=georgia>

    Any ideas?

    Basically I am trying to generate HTML output from a db query and include the output into a special textarea field.

  2. #2
    Lounger
    Join Date
    Sep 2004
    Location
    Evesham, Worcestershire, England
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Passing a value to an INCLUDE page

    I think an alternative way to do this would be to use a bit of javascript. In the page you are pushing the include into you could have the Javascript code declare the variable, assign it the value, and pointing it to the textarea. The processing (insertion of the text into the textarea) would then be done client side. In the parent document something like this:

    <script language="JavaScript" type="text/javascript">
    var MyText="<%your bit of text inserted server side with asp%>"
    document.myform.myID.value=MyText
    </script>

    And then in the include document you will need to assign an ID to the textarea field:

    <form name="myform">
    <textarea name="myID"></textarea>
    </form>

    With this set up the page would be assembled server side, then passed to the browser where the javascript would run and put the text into the textarea.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Passing a value to an INCLUDE page

    thanks for the suggestion -- but, not willing to fix something that isn't broken, I'll leave well enough alone. some comments, tho:

    1. SQL Server tends to insist that you explicitly query memo field information, so it's not that bad to have a small asp page that captures each of these memo fields (which is what I did in order to set up a page to include in the textarea).
    2. My design framework requires that all the webform element names are exactly the same as the column name they map to in the db, so I don't have much flexibility with the textarea names.

    I don't, BTW, think my solution is all that elegant -- it's a bit krufty as I am using cookies to hand var values over to fire the SQL when building the INCLUDE pages. I am overwriting the cookie each time the page reloads but I'm probably abusing the intention of include pages and cookies. Of course, if I were Microsoft, I could claim to be demonstrating innovation...

  4. #4
    Lounger
    Join Date
    Sep 2004
    Location
    Evesham, Worcestershire, England
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Passing a value to an INCLUDE page

    No problem. I just thought it was worth suggesting an alternative.

    Sometimes I've found myself strungling to tweak a solution to work when someone suggests a completely different way of attacking the problem and by changing track completely I've solve the problem much quicker.

Posting Permissions

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