
04-06-2009
|
Member | | Join Date: Feb 2008
Posts: 1,848
| |
Re: Issue with Clientscript Registerstartupscript Or simply try this code, you will not need RegisterStartupScript for this task. Quote:
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load()
{
StringBuilder sb = new StringBuilder();
sb.Append("var box1 = document.getElementById('");
sb.Append(TextBox1.ClientID);
sb.Append("');");
sb.Append("var box2 = document.getElementById('");
sb.Append(TextBox2.ClientID);
sb.Append("');");
sb.Append("if (box1 != null && box1.value.length == 5 && box2 != null)");
sb.Append("{");
sb.Append("box2.focus();");
sb.Append("}");
TextBox1.Attributes.Add("onkeyup", sb.ToString());
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" />
<asp:TextBox ID="TextBox2" runat="server" />
</div>
</form>
</body>
</html>
| Or try this : Quote:
string Script = "window.open('PasswordRecovery.aspx',null,'resizeable=no,scrollbars=no,addressbar=no,toolbar=no,widt h=300,Height=250')";
Type csType = this.GetType();
Page.ClientScript.RegisterStartupScript(csType, "PopupScript", Script, true);
| |