Ok, I'm dynamically creating Asp.net validation controls and inserting them into an update panel. The validation works in IE and Firefox, but not in Chrome or Safari.
Here is the aspx file. Don't ask why I'm not using a button server control...
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Always" runat="server">
<ContentTemplate>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
<input id="Button1" type="button" value="submit" onclick='javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("Button1", "btnNext", true, "", "", false, true))' />
</ContentTemplate>
</asp:UpdatePanel>
</div>
Here is the code behind:
Dim Survey As New Survey
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Request("__EVENTARGUMENT") = "btnNext" Then
NextClick()
End If
Label1.Text = Date.Now.ToString
End Sub
Private Sub NextClick()
Survey.RenderPage(PlaceHolder1)
End Sub
And here is the class:
Public Class Survey
Public Sub RenderPage(ByVal PlaceHolder As PlaceHolder)
Dim textbox As New TextBox
textbox.ID = "testing"
PlaceHolder.Controls.Add(textbox)
Dim val As New RequiredFieldValidator
val.ControlToValidate = textbox.ID
val.Text = "required"
val.EnableClientScript = True
PlaceHolder.Controls.Add(val)
End Sub
End Class
Does anyone have any ideas on how to get this to work in Chrome and Safari?