TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Craig Davis
NA
40
0
PostBackUrl troubles
Apr 20 2011 10:26 AM
Hi:
I get an (object reference not set to an instance of an object) error when I use a PostBackUrl as a method to pass data between pages. Please see following code. The code in red is highlighted in the error. This error occurs infrequently and seemingly randomly.
page 1------
<form id="form1" runat="server">
<<asp:Label ID="loginlbl" runat="server" Text="Login:"></asp:Label>
<asp:TextBox ID="logintxt" runat="server"></asp:TextBox><br />
<asp:Button ID="loginbutton" runat="server" PostBackUrl="page2.aspx" Text="Login" /><br />
</form>
codebehind for page 2------
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string previouslogin;
previouslogin = ((TextBox)PreviousPage.FindControl("logintxt")).Text;
.
.
.
.
.
.
}
}
}
Reply
Answers (
3
)
cut and paste not working with asp:Textbox
how to add calender control in asp.net