Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeremy 14 posts 35 karma points
    Dec 21, 2009 @ 18:01
    Jeremy
    0

    xslt and user control on 1 template

    <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-alt:"Calisto MT"; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-alt:"Times New Roman"; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman";} p {mso-style-noshow:yes; mso-style-priority:99; mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman","serif"; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} -->

    I have a template with 2 macros.  1. xslt file and 2.user control. 

    The xslt file renders a form on  the page based on an extension method.  The form then posts back to itself and the user control then gathers the information from the form and does some business logic.  If it succeeds then the user control redirects to another page.  If it fails it sets a session variable and comes back to the same page, which reads this session variable to render the message.

    The problem is this: When the business logic fails and the same page is re-rendered it does not read the session variable.  But when I refresh the page, it seems to find it.  How do I make sure that the Session variable is read the first time and not when I refresh the page?

    I am not sure if all this makes sense.  Please let me know if it doesn’t.  Any help would be greatly appreciated.

    Thanks,

    Jeremy

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Dec 23, 2009 @ 10:45
    Sebastiaan Janssen
    0

    You seem to be setting the session variable during the page load, if you put it in the prerender instead, you might see the result you're looking for.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Dec 23, 2009 @ 10:49
    Sebastiaan Janssen
    0

    Of course, you could also consider putting whatever you're putting in the session in the page items instead 

    ((Page)HttpContext.Current.Handler).Items.Add("someName", someObject);

    and getting it out like this:

    (objectType)((Page)HttpContext.Current.Handler).Items["someName"]

    Note that the page items are only available during 1 page load.

     

Please Sign in or register to post replies

Write your reply to:

Draft