我无法在按钮点击时打开多个webforms窗口。 [英] I am unable to open multiple webforms windows on button click.

查看:58
本文介绍了我无法在按钮点击时打开多个webforms窗口。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须搜索学校每个搜索过的学校都有复选框。如果我检查了2所学校并点击了比较按钮,那么我想显示那些在不同窗口中检查的学校的全部信息。但我的代码只打开一个弹出窗口。



这是代码。

i have to search schools every searched school has checkbox. if i checked 2 schools and clicked on compare button then i want to show the whole information of that schools which are checked in different different window. but my code opens only one popup.

Here is code.

protected void btncompare_Click(object sender, EventArgs e)
{
   for (int i = 0; i < rptrsearchschool.Items.Count; i++)
   {
      CheckBox chk = (CheckBox)rptrsearchschool.Items[i].FindControl("chkList");
      if (chk.Checked)
      {
         int i1 = Convert.ToInt32(chk.Attributes["Text"].ToString());
         string url = "ViewSchoolsforUser.aspx?SchoolID=" + i1; 
         Page.ClientScript.RegisterStartupScript(this.GetType(), "openwindow", "window.open('" + url + "','','height=600,width=450')", true);
              
           }
       }
    }

推荐答案

我自己完成了。这是一个演示代码。



I have done by Myself. this is a demo code.

protected void btnPop_Click(object sender, EventArgs e)
    {
        int i=1;
        string url = "" ;
        string name = "";
        if (i == 1)
        {
           url = "Login.aspx";
           i++;
           name = "my" + i;
           Response.Write("<script>window.open('" + url + "','"+name+"','width=400,height=400,left=300,top=150')</script>");
        }
        if (i == 2)
        {
            url = "Registration.aspx";
            i++;
            name = "my" + i;
            Response.Write("<script>window.open('" + url + "','" + name + "','width=400,height=400,left=300,top=150')</script>");
        }


这篇关于我无法在按钮点击时打开多个webforms窗口。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆