S
Scott M.
The following code (VS 2008) does cause the script string to render, but it
doesn't render inside of <script> tags, instead the result is rendered just
after the opening <form> tag, but outside of the other <script> tags that
are rendered automatically to handle my validation controls.
protected void Page_Load(object sender, EventArgs e)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(@"function vailidateCardType(sender, args){");
sb.Append(@"if(form1.elements['lstCardType'].selectedIndex == 0)");
sb.Append(@"{args.IsValid = false;}");
sb.Append(@"else {args.IsValid = true;}");
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"customValidator",
sb.ToString());
}
Any ideas?
doesn't render inside of <script> tags, instead the result is rendered just
after the opening <form> tag, but outside of the other <script> tags that
are rendered automatically to handle my validation controls.
protected void Page_Load(object sender, EventArgs e)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(@"function vailidateCardType(sender, args){");
sb.Append(@"if(form1.elements['lstCardType'].selectedIndex == 0)");
sb.Append(@"{args.IsValid = false;}");
sb.Append(@"else {args.IsValid = true;}");
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"customValidator",
sb.ToString());
}
Any ideas?