Click here to Skip to main content
15,895,829 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.
C#
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);
              
           }
       }
    }
Posted
Updated 1-Oct-14 20:36pm
v2
Comments
Sergey Alexandrovich Kryukov 2-Oct-14 2:16am    
Please explain: what do you mean by "opening a Web form"? Was it close?
What does it mean, "multiple Web forms", multiple on the same page, or anything else?
How is that related to the fragment of code you show?
—SA
MAK09 2-Oct-14 2:24am    
I have an search engine for school after that checkbox get checked by user and click on compare button. after that i want to open information on different window which the checkbox are checked.
Sergey Alexandrovich Kryukov 2-Oct-14 3:06am    
Do you know the purpose of a "Web form"? Only to send HTTP request. "Open information" has nothing to do with a form. Okay, what is "open information"?
Anyway, you still did not answer my question.
—SA
Samatha Reddy G 2-Oct-14 2:16am    
exactly what is your requirement? can you please explain in detail
MAK09 2-Oct-14 2:29am    
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.

1 solution

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

C#
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>");
        }
 
Share this answer
 
Comments
aarif moh shaikh 2-Oct-14 3:55am    
If i want to open more than one page at a time without giving any condition???
than what i have to do?
MAK09 6-Oct-14 1:55am    
that condition is for to change the name of every popups. more than one page means. because above solution opens 2 window popups. simply provide a url to popups.
aarif moh shaikh 7-Oct-14 0:28am    
ok.. thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900