Pass Variable To User Control

  • Thread starter Thread starter rhungund
  • Start date Start date
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" />
 
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
 
Back
Top