Why not getting Request.QueryString value in asp.net
Hi,I am passing value to another form from dropdowlist and textbox.
But I not getting Request.QueryString value in another aspx page.
So it is showing error..
'Object reference not set to an instance of an object.'
First form code:
----------------
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GM.SetProjectData(this.ddlProjectName, 0);
this.ddlProjectName.Items.Insert(1, new ListItem("All", "-1"));
this.GetProjectTollData();
this.tbStartDate.Attributes.Add("readOnly", "readOnly");
string _URL = "javascript:window.open('NewDefaultTollResult.aspx?ProjectName=" + this.ddlProjectName.SelectedIndex + "TollID=0" + "TollDate=" + this.tbStartDate.Text.ToString() + "');";
bFind.Attributes.Add("onclick", _URL);
}
}
protected void bFind_Click(object sender, EventArgs e)
{
TollEntity tollEntity;
TollLogic tollLogic;
try
{
tollEntity = new TollEntity();
tollLogic = new TollLogic();
if (GM.ConvertToDate(this.tbStartDate.Text) == GM.ConvertToDate(DateTime.Now.ToString("dd-MM-yyyy")))
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "Msg", "alert('Invalid Date, You cannot check today Date..');", true);
return;
}
if (this.ddlProjectName.SelectedIndex > 0 && this.ddlTollName.Items.Count == 0 && this.tbStartDate.Text.Trim() != string.Empty)
{
ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('NewDefaultTollResult.aspx?ProjectName=" + this.ddlProjectName.SelectedValue + "TollID= 0" + "TollDate=" + this.tbStartDate.Text.ToString() + "');", true);
}
else if (this.ddlProjectName.SelectedIndex > 0 && this.ddlTollName.SelectedIndex > 0 && this.tbStartDate.Text.Trim() != string.Empty)
{
ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('NewDefaultTollResult.aspx?ProjectName=" + this.ddlProjectName.SelectedIndex + "TollID=" + this.ddlTollName.SelectedValue + "TollDate=" + this.tbStartDate.Text.ToString() + "');", true);
}
//this.GetProjectTollData();
}
catch (Exception ex)
{
throw ex;
}
finally
{
tollEntity = null;
tollLogic = null;
source = null;
}
}
Second form code:
----------------
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["ProjectName"].ToString() != string.Empty && Request.QueryString["TollID"].ToString() != string.Empty && Request.QueryString["TollDate"].ToString() != string.Empty)
{
this.SetProjectTollData();
}
}
}