The following code works and updates the literal control perfectly. When I add the ajax manager, it doesn't update the control at all. I have tried probably 20 different things. I have tried the manager, the ajax panel, and cannot get this to work. If somebody could take a look at this very simple example and tell me what I am doing wrong, I would much appreciate the help. The literal control should come back with a message - like thank you, email not valid, etc.
Here is the aspx page.
Here is the code.
Thank You!
Here is the aspx page.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <ajaxsettings> <telerik:AjaxSetting AjaxControlID="Button1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="Button1" LoadingPanelID="RadAjaxLoadingPanel1" /> <telerik:AjaxUpdatedControl ControlID="txtEmail" /> <telerik:AjaxUpdatedControl ControlID="litStatus" /> </UpdatedControls> </telerik:AjaxSetting> </ajaxsettings> </telerik:RadAjaxManager> <br /> <br /> <asp:Button ID="Button1" runat="server" Text="Button" /> Email: <asp:TextBox ID="txtEmail" runat="server" Width="266px"></asp:TextBox> <br /> <asp:Literal ID="litStatus" runat="server">dddddddd</asp:Literal><br /><telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server" MinDisplayTime="3000" Skin="Default"></telerik:RadAjaxLoadingPanel>Here is the code.
Function AddEmail(ByVal strEmail As String) As Boolean Me.txtEmail.Text = "" Dim inputEmail As String = strEmail.Trim.ToLower Dim bSuccess As Boolean = False Dim strRegex As String = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" & "\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" & ".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" 'Validate email Dim re As New Regex(strRegex) If re.IsMatch(inputEmail) Then Else litStatus.Text = "Please enter a valid email to join our mailing list." ' litStatus.Text = "yeah are already a member. If you are not receiving our communications, please check your spam folder." Return (False) End If 'Open file and add email Dim xmldoc As New XmlDocument xmldoc.Load(Server.MapPath("xmlfile.xml")) 'Check to make sure the email doesn't already exist Dim m_nodelist As XmlNodeList = xmldoc.SelectNodes("emails/email") For Each m_node In m_nodelist Dim strEmailNode = m_node.ChildNodes.Item(0).InnerText.ToString.ToLower 'Get the lastName Element Value If strEmailNode = inputEmail Then litStatus.Text = "You are already a member. If you are not receiving our communications, please check your spam folder." Return (False) End If Next 'Append new node and save xml Dim newNode As XmlElement = xmldoc.CreateElement("email") newNode.InnerText = inputEmail xmldoc.DocumentElement.AppendChild(newNode) xmldoc.Save(Server.MapPath("xmlfile.xml")) litStatus.Text = "Thank you for joining our mailing list." AddEmail = TrueEnd FunctionThank You!