473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

pass value of a variable to user control

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 session variable...

could be glad if someone could tell me how to get it right... thanks,

regards,

Hermit Dave
Nov 18 '05 #1
3 2744
You need to use properties and pass them in the page load events for
example.....

Doug Stevens, another MVP has this very useful example whih explains the
approach

http://www.dotnetjunkies.com/Article...66F720AB013.dc
ik
--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:uV*************@TK2MSFTNGP11.phx.gbl...
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 session variable...

could be glad if someone could tell me how to get it right... thanks,

regards,

Hermit Dave

Nov 18 '05 #2
Hello John,

Thanks for the pointer. That article hopefully did show me what i wasnt
doing...
For same reason i did look around for the instance of user control in the
data member declaration earlier and couldnt find it...
Anyho... have to map the instance on aspx page to the code behind.. then i
should be able to populate the properties.. (ealier was passing hard coded
values from within aspx and that worked)
Thanks mate,

Regards,

Hermit Dave

"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:Od**************@TK2MSFTNGP11.phx.gbl...
You need to use properties and pass them in the page load events for
example.....

Doug Stevens, another MVP has this very useful example whih explains the
approach

http://www.dotnetjunkies.com/Article...66F720AB013.dc ik
--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:uV*************@TK2MSFTNGP11.phx.gbl...
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 session variable...

could be glad if someone could tell me how to get it right... thanks,

regards,

Hermit Dave


Nov 18 '05 #3

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:uV*************@TK2MSFTNGP11.phx.gbl...
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 session variable...

could be glad if someone could tell me how to get it right... thanks,

regards,

Hermit Dave


I know you have already been pointed to the Properites as fits your
question.

Just as a side note though, you can also use a Cache object for passing
information to an from controls and web user controls. They are very handy.

--
Rocky Moore
www.HintsAndTips.com

Nov 18 '05 #4

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

Similar topics

3
by: Nath | last post by:
Please help!? I am new to writing html, javascript, pretty new to MySQL but quite proficient at writing Perl and i'm a quick learner. I am building a database driven website and i am a little...
5
by: Seeker | last post by:
Newbie question here... I have a form with some radio buttons. To verify that at least one of the buttons was chosen I use the following code ("f" is my form object) : var btnChosen; for...
9
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.
0
by: ab_j | last post by:
I have a user control that contains a dropdown which I want to use as a menu on multiple .aspx pages. Basically, all I am trying to do is pass the selected value of the dropdown in the user...
12
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...
2
by: rhungund | last post by:
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...
4
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...
3
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...
12
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....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.