Facing difficulties:
i’m looking for popup window for chat application in asp.net-c#
protected void Page_Load(object sender, EventArgs e)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script language='javascript'>function Open() {");
sb.Append(string.Format("window.open('Chat.aspx?rid={0}'",lstRooms.SelectedValue));
sb.Append(, 'newwindow','toolbar=no,location=no,menubar=no,width=290,height=330,resizable=no,scrollbars=no,top=350,left=980,right=500'");return false;");
sb.Append("}</script>");
here is
if (!ClientScript.IsClientScriptBlockRegistered("JSScriptBlock"))
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "JSScriptBlock", sb.ToString());
}
if (!ClientScript.IsClientScriptBlockRegistered("JSScriptBlock"))
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "JSScriptBlock", sb.ToString());
}
i got error…too many characters in character literal…in this line
sb.Append(, 'newwindow','toolbar=no,location=no,menubar=no,width=290,height=330,resizable=no,scrollbars=no,top=350,left=980,right=500'");return false;");
thnks for guidence
i updated my question as above….plz help me
Here you can find a very easy and nice tutorial for popup with asp.net and ajax:
http://www.asp.net/web-forms/tutorials/ajax-control-toolkit/modalpopup/launching-a-modal-popup-window-from-server-code-cs
Hope it helps you.
Greetings
UPDATE:
this code is tested and works fine:
HTML:
C#
Of course you have to add the OnClick Attribute to your html button and point to the Open() Method.