473,587 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="applicati on/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:incN avigation runat="server" ID="theNavigati on"
pageName="home" />

Dec 15 '05 #1
2 3120
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:incN avigation runat="server" ID="theNavigati on" 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!

<rh******@gmail .com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.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="applicati on/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:incN avigation runat="server" ID="theNavigati on"
pageName="home" />

Dec 15 '05 #2
great. that worked! thank you.

Dec 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2752
by: Hermit Dave | last post by:
Hi, Trying to pass a value to user control within a page. 1. Couldnt find a way to pass it from code behind file. 2. Trying to pass it from aspx page... using EditURL='<% "mypage.aspx?myvar=" + myvalue %>' assigns value of EditURL='' I have tried using a local variable... directly trying to read it off Request object and even tried using...
9
2326
by: Frank Rizzo | last post by:
I've got a number of user controls on the web page. How can I pass some data to it? I don't see where the user control is instantiated in the page code-behind page. Thanks.
8
6572
by: darrel | last post by:
I'm still trying to fully understand how best to pass variables between pages/usercontrols/each other. On a current site I've done, I've had one userControl do the logic and set the variable, and then I had other usercontrols simply read this by traversing the class structure: siteClass.userControlClass.specficVariable. That worked fine....
12
2921
by: Phil Certain | last post by:
Hi, I'm trying to do something very simple...or at least it should be. I have created a host page (gen.aspx) and a very simple user control (us.ascx). The corresponding code-behind files are gen.aspx.vb and uc.ascx.vb. With simple html or self contained vb in the user control, everything is fine and dandy. So the next stage is to pass back...
1
2414
by: dollar | last post by:
I want to ask what is the best way to pass variable between asp.net we pages, and user controls , any examples - dolla ----------------------------------------------------------------------- Posted via http://www.codecomments.co -----------------------------------------------------------------------
4
2652
by: simon | last post by:
hello. relatively new to vb.net, i'm using VS 2003 and .net 2.0 i have a web app that i'm i have a user control that displays a simple 1 row table as the header of the page. the user control takes one input variable, the string that will be displayed as the title of the page. example call: <uc1:Header runat=server ID="ucHeader"...
3
1525
by: =?Utf-8?B?UmljaCBIdXRjaGlucw==?= | last post by:
I have a form, Form1, that shows an instance of Form2 when a user clicks a button. On Form2, the user is to select items, Customer Names for example, from a datagrid control. When the user clicks a button on Form2, I want to pass the text of the selected Customer Names in the datagrid back to a listbox control on Form1, but I'm stuck as to how...
7
1909
by: Rob | last post by:
lets assume I want to remove a control from a form that was dynamically created... If the button was added at design time, I can do the following... me.Controls.Remove(Button4) How may I pass a variable in the parameter position ? i.e., me.Controls.Remove(strVariable)
12
11048
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed!...
0
7923
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7852
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.