Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > pass value of a variable to user control

Reply
Thread Tools

pass value of a variable to user control

 
 
Hermit Dave
Guest
Posts: n/a
 
      12-12-2003
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


 
Reply With Quote
 
 
 
 
John Timney \(Microsoft MVP\)
Guest
Posts: n/a
 
      12-12-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Hermit Dave
Guest
Posts: n/a
 
      12-13-2003
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)" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
Rocky Moore
Guest
Posts: n/a
 
      12-13-2003

"Hermit Dave" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Variable Input on procedure - pass by value or pass by reference? Reuven VHDL 0 03-19-2009 07:21 PM
Re: Variable Input on procedure - pass by value or pass by reference? Tricky VHDL 0 03-19-2009 03:59 PM
Variable Input on procedure - pass by value or pass by reference? Tricky VHDL 0 03-19-2009 03:58 PM
Trying to pass a variable back from a user control Phil Certain ASP .Net 12 02-01-2005 10:55 AM
Pass a form value from a user control to parent control - Event Order issues ab_j@flyingrobot.com ASP .Net 0 10-29-2004 05:38 PM



Advertisments