I have written the javascript function to open new window and pass parameter. Then I use request.Querystring method to get the parameter from the popup.
But if it get any null value then it throw exception. The exception is "Object reference not set to an instance of an object.". I have provided condition to recover this problem.
But not work. My code is here :
function strgetStyleNo() {
var a = $("[id$='ddlStyleNo']").val();
var b = $("[id$='ddlDefectType']").val();
var d1 = $("[id$='txtFromDate']").val();
var d2 = $("[id$='txtToDate']").val();
if (a != "") {
window.open("Reports/Smt_StyleWiseReportWindow.aspx?Names=" + a + "", "mywindow", "status=1,toolbar=1, width=900px, height=600px,left=250,top=100");
}
if (b != "") {
window.open("Reports/Smt_StyleWiseReportWindow.aspx?defect=" + b + "", "mywindow", "status=1,toolbar=1, width=900px, height=600px,left=250,top=100");
}
if (d1 != "") {
window.open("Reports/Smt_StyleWiseReportWindow.aspx?dt1=" + d1 + "&dt2"+d2+"", "mywindow", "status=1,toolbar=1, width=900px, height=600px,left=250,top=100");
}
}
string strStyleCode = "";
string defecttype = "";
if (Request.QueryString["Names"].ToString() != "" || Request.QueryString["Names"].ToString() != null)
{
strStyleCode = Request.QueryString["Names"].ToString();
}
else if (Request.QueryString["defect"].ToString() != "" || Request.QueryString["defect"].ToString() != null)
{
defecttype = Request.QueryString["defect"].ToString();
}