popup window

Mar 14 2009 5:29 AM
hai,
i could not able to open a popup window in a page _load event ,iam using javascript function ,below is my code .so ,please help me

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
          
            if (Session["Admin_Id"] != null)
            {
                //Lbladminname.Text = "Hi" + Session["username"].ToString();
               // Response.Write(Session["username"].ToString());
                //Lbladminname.Text = "Dear" + Session["username"].ToString();
                //showlastlogindata();
              
                showlastlogindata();
              
               
                Label lbl = (Label)Master.FindControl("Lbladminname");

                Label lblt = (Label)Master.FindControl("Lbltime");
                if(lbl !=null)
                {
                lbl.Text =" Welcome " + Session["username"].ToString().Trim();
                }
                if (lblt != null)
                {
                    lblt.Text = DateTime.UtcNow.ToLongDateString().ToString();
                }

                //HttpCookie mycookie = Request.Cookies["link"];
                if (Session["link"] != null)
                {
                    //Response.Write(Session["link"].ToString());
                    Response.Redirect("PropertyViews.aspx");
                }
                else
                {
                    OpenNewWindow("Remainder.aspx");
                   
                }
               

                //Lbllastlogin.Text = Session["username"].ToString();
            }
            else
            {
                Response.Redirect("Adminlogin.aspx");
            }
            //addlogs();
        }
    }


 public void OpenNewWindow(string url)
    {

        //ClientScript.RegisterStartupScript(this.GetType(), "newWindow", string.Format("<script>window.open('{0}',url,'winFeatures');</script>"));
        string winFeatures = "toolbar=no,status=no,menubar=no,location=center,scrollbars=no,resizable=no,height=300,width=400";
        //ClientScript.RegisterStartupScript(this.GetType(),"newWindow", string.Format("<script type='text/javascript'>window.open('{0}', 'yourWin', '{1}');</script>", url, winFeatures));

        ClientScript.RegisterStartupScript(this.GetType(), "newWindow", string.Format(@"<script type=""text/javascript"">window.open('{0}', 'yourWin', '{1}');</script>", url, winFeatures));


    }
sp ,please check the above code and find me a solution please
thanks in advance
sai

Answers (2)