Pass Variable To User Control

R

rhungund

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" />
 
K

Karl Seguin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top