problem in Cross-Page Posting in ASP.NET Web Pages

i have a link button in a page . i want to use that link button in another page i have writen like this:-

LinkButton lnk = (LinkButton)PreviousPage.FindControl("Linkbutton1");

if (lnk.Text == "Log out")

{

Session.Clear();

Session.Abandon();

//Response.Redirect("Default.aspx");

Response.Write("<script>");

Response.Write("window.opener='_top';window.open('for_students.aspx');window.close();");

Response.Write("</script>");

 

}

but i am getting the error like

Object reference not set to an instance of an object.

can any body tell me what is going wrong.plz help me..and give me a solution..

0
suvo
3/24/2008 12:11:27 PM
asp.net.state-management 8807 articles. 0 followers. Follow

1 Replies
1177 Views

Similar Articles

[PageSpeed] 51

Hi,

Here I have explained with 2 scenarios.

1. The FindControl method finds controls in the current naming container. If the control you are looking for is inside another control (typically, inside a template), you must first get a reference to the container and then search the container to find the control you want to get.

2. May be you reached the target page via redirect or transfer method. Before accessing "PreviousPage", plz validate by the following code

if(PreviousPage != null)
{
    if(PreviousPage.IsCrossPagePostBack == true)
    {
         //TODO
    }
}
 

Regards,
Prakash


www.aristonsoft.com - .net 3.5 hosting provider in India.
0
pgnanaprakash
3/25/2008 12:28:31 PM
Reply:

Similar Artilces:

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

Could PB .NET Web Form POST security Information to others web page??
This is a multi-part message in MIME format. ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable Hi,=20 Have anyone came across the requesion to POST security informations from = PB .NET web form web page to other web site?? I have tried many datys, Could any kind man give me some suggessions?? thanks & Best regards Leon ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML P...

State management in cross page posting
Hi, I have a main asp.net form. From this form I "server.transfer" to another form to pick up data from a search list which is used to fill fields in the main form. But when I come back to the main form, the fields that had been filled before calling the search form are cleaned out. Is there an easy way to retain the values in the original form when I cross  post back from the search form? Regards, Sandyhttp://www.thequinn.infohttp://www.sksdataservices.comhttp://www.infobasket.info Hello,You can use session to store your value.To store value in session writestring yourVa...

Cross page posting in .net 1.1
 I want to transfer text box values between 2 aspx pages. I'm getting a compilation error when I do this. Could someone help me with this? Here is my code. FYI - I'm trying to build a form builder. In Crit.aspx , the user enters personal info, answers some questions and when the submit button is clicked,  the user is transferred to Thankyou.aspx. I want to access the user info in thankyou.aspx.Crit.aspx <form name="formCrit" method="post" action="Thankyou.aspx" runat="server"><TR><TD><asp:Label id="lblAd...

Paging Paging Paging
I am trying to do paging with my search results and it isnt working very well. Here is what I've tried and I feel I've tried everything, lol, please help me out. Sub DataGrid1_SortCommand(Sender as object, e as DataGridSortCOmmandEventArgs) DataGrid1.DataBind() End Sub Sub Datagrid1_PageIndexChanged(Sender as object, e as DataGridPageChangedEventArgs) Dim ds as dataSet DataGrid1.CurrentPageIndex = e.NewPageIndex if Session("Search") is nothing then 'Session probably has expired, get the datasource from database Datagrid1.DataSource = ...

Can a .NET 1.1 page execute in a .NET 2.0 web site?
I've got a ASP.NET 1.1 web site to which I would like to add some ASP.NET 2.0 web pages. Could I just change the web site to point to the 2.0 .NET version and still have the .NET 1.1 web pages work so that both versions are in the same web site? Have you some of you approached this? Thanks. The official answer is maybe It's not officially supported, but most ASP.NET 1.1 pages will run fine under ASP.NET 2.0.  Officially you should run the upgrade wizard on your 1.1 pages. This is a  pretty good blog entry.      JamesMy Blog: http://www.wintersfamily.plus.c...

Problem with a Web page (http://www.vandal.net/foro)
Name: Andres Trujillo Email: andres2007atmsndotcom Product: Firefox Release Candidate Summary: Problem with a Web page (http://www.vandal.net/foro) Comments: This forum has a feature that reduces the size of images so that the forum is not affected by very big pictures. Under the scaled image there is a link that says "ampliar" (amplify), and, when clicked, the full-size image appears (on the same window). With Firefox 3, I can't see the full-size images. In fact, nothing happens when I click "amplify." Browser Details: Mozilla/5.0 (Windows; U; Windo...

Problem Adding a Connection Object to Web page in VB.NET
I'm creating VB.NET Web applications on a remote Web Server trying to access an SQL Server database on the same box as the Web Server. I created the database on the server using the upsizing wizard of Access. I can create a connection, and access the database using a Web page when I use my account name and password. I'm now trying to do the same thing using a student account name and password. I created the student accounts on the server using active directory. The students can create web pages on the server. I have Visual Studio Open and Server Explorer visible. I right-click on Da...

Posting filepath in file upload control in .NET to the next page and uploading the file from second page
In our application (using C# .NET) there is a form with file upload options. After filling up the form details, the summary of the details need to be shown in the next page before committing the information into the database. Right now, Server.Control is used to transfer the contents to the next page and the form details are retrieved using Request.Form["control id"]. But this is not working for File upload control alone.File upload can not be done in the first page itself, as the foreign key in File upload table gets updated only in second page after confirmation. Therefore, is th...

Both C# ASPX pages and VB.NET ASPX in single VB.NET Web Applcation Template
Hi.. Is it possible to have both c# pages and VB pages in same Webapplication, what i chose is VB.NET Web application Template. With Thanks, Jaya.... I don't see why you couldn't, but for the sake of consistency I don't know why you would want to do this. When you choose a C# or VB.NET application template(I'm assuming you're using VS or WebMatrix), it simply creates a .aspx file that includes a page directive that specifies the page language. If you created a C# template but want to use VB.Net instead, you need to go from: <%@ Page Language="C#" .... to...

Having Problem in Posting Value from a Content Page to another Content Page within a Same Master Page
Hello, I have a Master Page which contains two Content pages named: Default.aspx and Default2.aspx. I want to post a TextBox1 value (in Default.aspx) to Default2.aspx in the Master Pages and all my pages are in ContentPlaceHolder, but it is not working.   Is there Any kind of help?  Hi,you can pass value between two web forms by Query string, session  or by using cookieFor query string  refer : http://www.codeproject.com/KB/aspnet/QueryString.aspxSession: save session in default.aspx Session("t1")=text1.text retrieve session astext2.text = session(&quo...

html content pageing in .net page
hi... i have a problem and i'm not find in web this problem. problem :  text data recorded in database and this text data content HTML. i want to pageing this textdata in page. i try count to character but to be HTML tag in text data... i hope understand me.  Hi. You can try using Server.HtmlEncode("<b>Your HTML Content Here</b>")Please don't forget to click "Answer" if it helps you as it may help others also. no no i'm not find this. i write problem again : example have a text (3000 character) and i do paging this text....

Cross-Page posting between 3 pages
I have 3 pages and i use a Link button to go from "step 1 to step 3" In the first page i have: Public ReadOnly Property CurrentTitolo() As String Get Return TextBoxTitolo.Text End Get End Property  In the second i can access the "inserted values":Partial Class Page02Inherits System.Web.UI.PagePrivate titolo As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then titolo = PreviousPage.CurrentTitolo End If ...

Cross posting from a page with a master page
Hi. I'm trying to get the different methods for posting to another asp page to work. I'm a newbie with asp.net and c# so please bear with me. First the "FindControl" method. I can't seem to locate the text control when its on a page that has a master page. Do I have to first find the master page container and then find the text control in that? It looks like if I do:ControlCollection col = PreviousPage.Controls;Control c = col[0]; // this is the master page controlThe master page has a collection of controls, and so on and I can see why hunting down the control is a t...

Cross Page Post from Master Page
Hi Guys I have a search form (advanced - losts and lots of fields) on my masterpage (cause it has to be available from everywhere). I want to post the form to an aspx page which will display the search results. I thought it would be as simple as setting up the postbackurl on the button, but i think theres are problem as it's being posted by a master file and not a page. The IsCrossPagePostBack field and the IsPostBack field both return false, and PreviousPage.FindControl returns null for all controls. Does anyone have any idea on how I can implement this functionality (post masterpage f...

Web resources about - problem in Cross-Page Posting in ASP.NET Web Pages - asp.net.state-management

∞ iTunes adds Red Cross donation page for Haiti relief
Apple has made it easy for iTunes Store users to donate money to the American Red Cross, for Haitian earthquake relief.

American Red Cross – News Stories About American Red Cross - Page 1 - Newser
American Red Cross - Find news stories, facts, pictures and video about American Red Cross - Page 1 - Newser

David Cross - Page Six
... Reading Photos Cindy Adams Richard Johnson Sub Menu 1 Sightings We Hear Just Asking Sub Menu 2 NY Post Decider IAF Sign in nypost.com On Page ...

Max Croes - Posts - Page 2 -
SB Nation is the fastest growing online sports media brand, consisting of national sports site SBNation.com and 300 individual team and sport ...

Driving Landing Page Conversions: SEO Tells You Where, But CRO Tells You How by @shanejones15
... Google+ or if you reach out via his blog. Twitter Google+ LinkedIn The post Driving Landing Page Conversions: SEO Tells You Where, But CRO ...

The Walking Dead Cross-Stitched Page: Fabric Novel
... Cross Stitch Ninja did. You can see a higher resolution version of the piece as well as in progress shots on Cross Stitch Ninja’s Flickr page ...

International Committee of the Red Cross Topics Page - USATODAY.com
Collection of all USATODAY.com coverage of International Committee Of The Red Cross, including articles, videos, photos, and quotes.

Cross stitch recreation of a page from the Walking Dead comic book
... how long it took me to draw this damn thing in pen and ink, I'm particularly honored and impressed by this painstaking Walking Dead cross-stitch!" ...

Search For ‘Jeremy Cross in Bruges’ - Page 1 - Daily Star
We found 2 results for ‘Jeremy Cross in Bruges’ within all sections

American Red Cross Topics Page - USATODAY.com
Collection of all USATODAY.com coverage of American Red Cross, including articles, videos, photos, and quotes.

Resources last updated: 1/24/2016 1:10:33 AM