Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2005

Tip: Looking for answers? Try searching our database.

Cross Page posting problems asp.net 2.0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bryan - 20 Oct 2005 17:49 GMT
I am trying to get to a label control to get its Text value. from a previous
page.

The label control is buried in a  Web User Control that is in a  webpart
zone. When I use  this code:
foreach(Control c in PreviousPage.Controls)
{
   and try to find the control here.

}

I can only see the masterpage, then another loop inside that gets me some
literal controls etc.

I cannot even find the Web Part Zone! Please help, is there an easier way to
do this?

Thanks,
Bryan
Curt_C [MVP] - 20 Oct 2005 18:40 GMT
store the value in the page postback (session, db, etc) and then read it in
on page2.
Signature

Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

> I am trying to get to a label control to get its Text value. from a previous
> page.
[quoted text clipped - 15 lines]
> Thanks,
> Bryan
Bryan - 20 Oct 2005 19:55 GMT
True, but I was just trying to use the new functionality in 2.0.

If anyone can help using cross page posting using 2.0 that would be great!

Thanks!
Bryan

> store the value in the page postback (session, db, etc) and then read it
> in
[quoted text clipped - 21 lines]
>> Thanks,
>> Bryan
Steven Cheng[MSFT] - 21 Oct 2005 07:08 GMT
Hi Bryan,

As for your scenario, the Previous Page's control hierarchy is very
complex, I'd suggest that we first define a public property in the previous
page's page class to expose that certain inner control. for example:

================
public Label InnerLabel
{
get
{
    WebPart hw = WebPartZone1.WebParts[0];
    UserControl uc = hw.FindControl("HelloWorld1") as UserControl;
    Label lbl = uc.FindControl("lblMessage") as Label;

    return lbl ;
}
}

==================

then, you can access this propety in the perviouspage instance (through
reflection or strong typed instance) in the target post page's code.

Thanks,

Steven Cheng
Microsoft Online Support

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "Bryan" <BryanZM@nospam.nospam>
| References:  <#Mj58YZ1FHA.2616@tk2msftngp13.phx.gbl>
<9726258A-09A7-4A6C-AE42-DE4602A0A262@microsoft.com>
| Subject: Re: Cross Page posting problems asp.net 2.0
| Date: Thu, 20 Oct 2005 11:55:59 -0700
[quoted text clipped - 9 lines]
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:132842
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
[quoted text clipped - 30 lines]
| >> Thanks,
| >> Bryan
Scott Allen - 21 Oct 2005 14:07 GMT
Stephen suggestion is good. I also have some additional information
that shows how to use the strongly typed PreviousPage:

http://odetocode.com/Articles/421.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/
Steven Cheng[MSFT] - 27 Oct 2005 09:57 GMT
Hi Bryan,

How are you doing on this issue, does the suggestion in my last reply helps
a little? If there're anything else we can help, please feel free to post
here.

Thanks,

Steven Cheng
Microsoft Online Support

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: Scott Allen <scott@nospam.odetocode.com>
| Subject: Re: Cross Page posting problems asp.net 2.0
| Date: Fri, 21 Oct 2005 09:07:02 -0400
| Message-ID: <ttphl1p80h4k4tbfuu482iie4le3f87lop@4ax.com>
| References: <#Mj58YZ1FHA.2616@tk2msftngp13.phx.gbl>
<9726258A-09A7-4A6C-AE42-DE4602A0A262@microsoft.com>
<OuRfyfa1FHA.664@tk2msftngp13.phx.gbl>
<U4auqXg1FHA.1172@TK2MSFTNGXA01.phx.gbl>
| X-Newsreader: Forte Agent 1.8/32.548
| MIME-Version: 1.0
[quoted text clipped - 5 lines]
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:133006
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
[quoted text clipped - 6 lines]
| Scott
| http://www.OdeToCode.com/blogs/scott/

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.