Showing posts with label include. Show all posts
Showing posts with label include. Show all posts

Saturday, March 24, 2012

Pass variable through include url

Well,
I have made a template which shows the header.
Now in an empty page I include it on the top and this way it shows when I query the page also the header.
This works.
Now I want in the header there is a cell which is empty to show a message.
This message is dynamic, so it depends on what you give as message.
I could it make that when I query index.aspx?message=test that in my header(header.aspx) it shows the message test.
Now want to do it this way.
I query index.aspx
but in index.aspx I do an include this way:
<!--#include file="template/header.aspx"-->
that I make it this way:
<!--#include file="template/header.aspx?message:test"-->
this way I can show on my header a message in that empty cell without the user seeing it in the url.
Is this possible?

Eeek...
You're really going about this a hard way.
If you aren't using 2.0 (which I'm assuming you aren't) then I'd create the header as a UserControl.
Then just plop it on the page. You can easily create a Public Property on the header then, that is accessible from the page, that you can set the Text to...

Pass Variable To User Control

Hi all. I have a user control I'm using as my "include" file for my
flash navigation. My asp.net app is written in vb.net. The swf file
takes a parameter which I would like to pass into my user control.
Ideally i'd like to do something like this:
<object type="application/x-shockwave-flash"
data="flash/navigation.swf?page=<%pageName%>" width="850" height="148">
<param name="movie" value="flash/navigation.swf?page=<%pageName%>" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
</object>
So how, in all my other pages I'd like to call it like this:
<myControl:incNavigation runat="server" ID="theNavigation"
pageName="home" />if you make PageName a property of the user control, this is pretty easy.
private _pageName as string
public property PageName as String
get
return _pageName
end get
set (value as string)
_pageName = value
end set
end property
public sub void Page_Load(...)
..
end sub
you can then do, as you want
<myControl:incNavigation runat="server" ID="theNavigation" PageName="home"
/>
and use PageName in your object, but make sure to use <%= PageName %> (you
were missing the = in your example)
Karl
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!
<rhungund@.gmail.com> wrote in message
news:1134604813.689597.220380@.g43g2000cwa.googlegroups.com...
> Hi all. I have a user control I'm using as my "include" file for my
> flash navigation. My asp.net app is written in vb.net. The swf file
> takes a parameter which I would like to pass into my user control.
> Ideally i'd like to do something like this:
> <object type="application/x-shockwave-flash"
> data="flash/navigation.swf?page=<%pageName%>" width="850" height="148">
> <param name="movie" value="flash/navigation.swf?page=<%pageName%>" />
> <param name="quality" value="high" />
> <param name="bgcolor" value="#000000" />
> </object>
> So how, in all my other pages I'd like to call it like this:
> <myControl:incNavigation runat="server" ID="theNavigation"
> pageName="home" />
>
great. that worked! thank you.