Rahul sharma

Rahul sharma

  • NA
  • 456
  • 2.1k

I using repeater in Masterpage How I can Activate Item_Command Event of Repeater

Feb 14 2012 8:21 AM
  protected void chatrepeter_ItemCommand(object source, RepeaterCommandEventArgs e)
   {
       SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["LinqChatConnectionString"].ToString());
       if (e.CommandName == "Click")
       {
           string linkUpid = e.CommandArgument.ToString();
           //Response.Redirect("ChatRoom.aspx");
           Session["ChatUserID"] = userId;
           Session["ChatUsername"] = Username;
           string s = Session["UPID"].ToString() + "-" + linkUpid;
           int a = CheckExistance(s);
           if (a > 0)
           {
               con.Open();
               SqlCommand cmd = new SqlCommand("update LoggedInUser set chatid='" + s + "' WHERE upid='" + Session["UPID"].ToString() + "' and upid='" + linkUpid + "'", con);
               cmd.ExecuteNonQuery();
               con.Close();
               string myroom = myroomiD(s);
              // Response.Redirect("Chatroom.aspx?roomId=" + myroom + "&ReqChatID=" + s + "");
              
               Page.ClientScript.RegisterClientScriptBlock(typeof(Page), this.UniqueID, "window.open('Chatroom.aspx?roomId=" + myroom + "&ReqChatID=" + s + "','width=800px','height=200px','scrollbars=1','menu=1','scroll=yes',null,'yes');", true);
           }
           else
           {
               con.Open();
               SqlCommand cmd1 = new SqlCommand("insert into dbo.Room(Name) values('" + s + "')");
               cmd1.ExecuteNonQuery();
               cmd1.CommandText = "update LoggedInUser set chatid='" + s + "' WHERE upid='" + Session["UPID"].ToString() + "' or   upid='" + linkUpid + "'";
               cmd1.ExecuteNonQuery();
               con.Close();
               string myroom = myroomiD(s);
              // Response.Redirect("Chatroom.aspx?roomId=" + myroom + "&ReqChatID=" + s + "");
               Page.ClientScript.RegisterClientScriptBlock(typeof(Page), this.UniqueID, "window.open('Chatroom.aspx?roomId=" + myroom + "&ReqChatID=" + s + "','width=800px','height=200px','scrollbars=1','menu=1','scroll=yes',null,'yes');", true);
           }
       }
   }


Pop-up Cannot Open