Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Cross page posting with Master page

Reply
Thread Tools

Cross page posting with Master page

 
 
=?Utf-8?B?QXR1bCBCYWhs?=
Guest
Posts: n/a
 
      07-25-2005
I am not able to reference values by using cross page postings when using
master page.

Currently I am runing on beta 2 of CLR.

Any ideas...

Thanks

Atul
 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      07-25-2005
What problem are you having?

-Brock
DevelopMentor
http://staff.develop.com/ballen



> I am not able to reference values by using cross page postings when
> using master page.
>
> Currently I am runing on beta 2 of CLR.
>
> Any ideas...
>
> Thanks
>
> Atul
>




 
Reply With Quote
 
 
 
 
=?Utf-8?B?QXR1bCBCYWhs?=
Guest
Posts: n/a
 
      07-25-2005
Many thanks Brock for responding back, I am actually stuck.

K my problem is that I am using cross page posting from one page to another.
It seems to work fine if I do not use Master page but the moment I use master
page the code reference does not work on the second page.

TextBox textbox1;
textbox1= (TextBox)PreviousPage.FindControl("TextBox1");

on the second page textbox1 shows null with master page.

I do have form tag in master page so I am thinking whether that is the
problem or what is the work around.

Thanks in advance.

Atul




"Brock Allen" wrote:

> What problem are you having?
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>
> > I am not able to reference values by using cross page postings when
> > using master page.
> >
> > Currently I am runing on beta 2 of CLR.
> >
> > Any ideas...
> >
> > Thanks
> >
> > Atul
> >

>
>
>
>

 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      07-25-2005
I'd suggest not using FindControl and use the strongly typed PreviousPage.
I posted about this a while back:

http://staff.develop.com/ballen/blog...c-d3b8b4f29eaf

-Brock
DevelopMentor
http://staff.develop.com/ballen



> Many thanks Brock for responding back, I am actually stuck.
>
> K my problem is that I am using cross page posting from one page to
> another. It seems to work fine if I do not use Master page but the
> moment I use master page the code reference does not work on the
> second page.
>
> TextBox textbox1;
> textbox1= (TextBox)PreviousPage.FindControl("TextBox1");
> on the second page textbox1 shows null with master page.
>
> I do have form tag in master page so I am thinking whether that is the
> problem or what is the work around.
>
> Thanks in advance.
>
> Atul
>
> "Brock Allen" wrote:
>
>> What problem are you having?
>>
>> -Brock
>> DevelopMentor
>> http://staff.develop.com/ballen
>>> I am not able to reference values by using cross page postings when
>>> using master page.
>>>
>>> Currently I am runing on beta 2 of CLR.
>>>
>>> Any ideas...
>>>
>>> Thanks
>>>
>>> Atul
>>>




 
Reply With Quote
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      07-25-2005
You should be able to get the value with code like this:

MyString = Request.Forms("TextBox1").ToString()

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


"Atul Bahl" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Many thanks Brock for responding back, I am actually stuck.
>
> K my problem is that I am using cross page posting from one page to
> another.
> It seems to work fine if I do not use Master page but the moment I use
> master
> page the code reference does not work on the second page.
>
> TextBox textbox1;
> textbox1= (TextBox)PreviousPage.FindControl("TextBox1");
>
> on the second page textbox1 shows null with master page.
>
> I do have form tag in master page so I am thinking whether that is the
> problem or what is the work around.
>
> Thanks in advance.
>
> Atul
>
>
>
>
> "Brock Allen" wrote:
>
>> What problem are you having?
>>
>> -Brock
>> DevelopMentor
>> http://staff.develop.com/ballen
>>
>>
>>
>> > I am not able to reference values by using cross page postings when
>> > using master page.
>> >
>> > Currently I am runing on beta 2 of CLR.
>> >
>> > Any ideas...
>> >
>> > Thanks
>> >
>> > Atul
>> >

>>
>>
>>
>>



 
Reply With Quote
 
jasonkester
Guest
Posts: n/a
 
      07-26-2005
Ah, posts like this always bring a smile to my face.

All I can see is a bright future full of consulting work to clean up
after this new crop of web developers who don't even realize that they
are submitting forms from HTML pages. Yessir, we're set for life,
fellas!

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/

 
Reply With Quote
 
akaEdge akaEdge is offline
Junior Member
Join Date: Feb 2008
Posts: 1
 
      02-25-2008
I had to do this to access my hidden field's value:

Request.Form["ctl00$ContentPlaceHolder1$PassedProductCategoryID "]

OR

Page.PreviousPage.Master.Controls[3].Controls[3].FindControl("PassedProductCategoryID")

which is more ".NET" but still not very good as FindControl isn't recursive so I still needed to use Controls[3] for the Form and the second Controls[3] for the content place holder. Check Rick Strahl's post on recursive FindControl http://www.west-wind.com/WebLog/posts/5127.aspx

I've seen other people just do Master.FindControl("controlName") - but for some reason that never works for me?

Brock's method doesn't work in the situation I have either, as I only do a cross page postback the first time to my page, subsequent times need to stay on the same page.

K. Scott Allen has some good stuff on Masterpages at http://www.odetocode.com/Articles/450.aspx including a bit about cross page postbacks and using the @MasterType directive, I'm going to give it a go
 
Reply With Quote
 
ExpertPractice ExpertPractice is offline
Junior Member
Join Date: Jan 2010
Posts: 7
 
      01-14-2010
Hi,
For the users still looking for the solution.

Try this :
///Getting ContentPlaceHolder from the Previous Page
ContentPlaceHolder Holder = (ContentPlaceHolder)Page.PreviousPage.Master.FindC ontrol("ContentPlaceHolder1");
/// Getting Textbox from the ContentPlaceHolder
TextBox tbox= (TextBox) Holder.FindControl("TextBox1");

hope this will help

@li
 

Last edited by ExpertPractice; 01-14-2010 at 12:44 PM..
Reply With Quote
 
mohanhegde mohanhegde is offline
Junior Member
Join Date: Nov 2010
Posts: 1
 
      11-24-2010
Quote:
Originally Posted by ExpertPractice
Hi,
For the users still looking for the solution.

Try this :
///Getting ContentPlaceHolder from the Previous Page
ContentPlaceHolder Holder = (ContentPlaceHolder)Page.PreviousPage.Master.FindC ontrol("ContentPlaceHolder1");
/// Getting Textbox from the ContentPlaceHolder
TextBox tbox= (TextBox) Holder.FindControl("TextBox1");

hope this will help

@li
Thanks a million buddy!!!

I really broke my head with this particular issue... thought i was the one who was coding it wrong!

Man, i registered to this forum just to say thanks to you... Cheers
 
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
Cross Page Post Back When Using Mixture of Master Pages and Non-Master Pages Jason@webbit.com ASP .Net 1 05-16-2006 02:00 PM
Cross Page Posting using public property on previous page =?Utf-8?B?dGhlV2l6YXJkMQ==?= ASP .Net 2 04-20-2006 08:27 PM
CROSS-POSTING, OR MULTI-POSTING, OR NEITHER? Colin D Digital Photography 56 03-08-2006 08:31 PM
How do I do cross page posting from a master page? Alan Silver ASP .Net 4 01-22-2006 11:01 AM
seeking servlet "Master" keep getting "Master/servlet/Master" not found. Tomcat 5.0.25 Doug McCann Java 1 08-05-2004 09:16 PM



Advertisments