Click here to Skip to main content
15,913,584 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I had a RegularExpressionValidator inside the update panel which not working it dosen't show the error message if i remove updatepanel it works can any one helps me to work the RegularExpressionValidator inside the updatepanel 


C#
<asp:Panel ID="pnlPopup"  BorderStyle="Solid" runat="server" >
   <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
   <ContentTemplate>

       <div style="background-color:GrayText;">
           <table border="0">
               <tr>
                   <td colspan="3" style="background-color:Maroon;color:White;font-weight:bold" > Time Sheet Entry </td>
               </tr>
               <tr>
                   <td><asp:Label ID="lblEtyID" Text="EntryID" runat="server" Visible="False"></asp:Label></td>
                   <td><asp:TextBox ID="txtEtyID" runat="server" Enabled="False" Visible="False"
                           Width="400px"></asp:TextBox></td>

               </tr>
               <tr>
                   <td> <asp:Label ID="lbluserid" Text="UserID" runat="server" Visible="False"></asp:Label></td>
                    <td><asp:TextBox ID="txtUserID" runat="server" Enabled="False" Visible="False"
                            Width="402px"></asp:TextBox></td>
               </tr>
               <tr>
                   <td><asp:Label ID="lbltypeid" Text="Type" runat="server"></asp:Label></td>
                   <td><asp:DropDownList ID="ddlTypeid" runat="server" Width="408px" AutoPostBack="true"
                         DataTextField="ItemName" AppendDataBoundItems ="true"  onselectedindexchanged="ddlTypeid_SelectedIndexChanged">
                           <asp:listitem selected="True" text="--Select--" value=""></asp:listitem>
                           </asp:DropDownList> </td>
               </tr>
               <div id="divTypedevelopment"  runat="server">
               <tr>
                   <td><asp:Label ID="lblProID" Text="ProductName" runat="server"></asp:Label></td>
                   <td><asp:DropDownList ID="ddlproductid" runat="server" AutoPostBack="true"
                          AppendDataBoundItems ="true"  onselectedindexchanged="ddlproductid_SelectedIndexChanged" Width="406px">
                            <asp:listitem selected="True" text="--Select--" value=""></asp:listitem>
                          </asp:DropDownList></td>
                          <td><asp:Label ID="Label5" runat="server" Text="*" style="color:Red"></asp:Label></td>
               </tr>
               <tr>
                    <td><asp:Label ID="lblverid" Text="VersionNumber" runat="server"></asp:Label></td>
                    <td><asp:DropDownList ID="ddlversionid" runat="server" Width="408px">
                    <asp:listitem selected="True" text="--Select--" value=""></asp:listitem>
                    </asp:DropDownList></td>
                    <td><asp:Label ID="lblmand" runat="server" Text="*" style="color:Red"></asp:Label></td>
               </tr>
               <tr>
                    <td class="style2"><asp:Label ID="lblbug" Text="BugID" runat="server"></asp:Label></td>
                    <td class="style2"><asp:TextBox ID="txtBugid" runat="server" Width="30%"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ControlToValidate="txtBugid" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator></td>
                    <td class="style2"><asp:Label ID="Label1" runat="server" Text="*" style="color:Red"></asp:Label>
                        <%--<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                              ControlToValidate="txtBugid" ValidationGroup="First" ErrorMessage="Enter only Numbers" > </asp:RegularExpressionValidator>--%>
                    </td>
               </tr>
               </div>
                <div id="divTypesupport"  runat="server">
               <tr>
                     <td><asp:Label ID="lblsuppid" Text="SupportID" runat="server"></asp:Label></td>
                     <td><asp:TextBox ID="txtSupportid" runat="server"></asp:TextBox> </td>
                     <td><asp:Label ID="Label2" runat="server" Text="*" style="color:Red"></asp:Label>
                         <%--<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
                          ControlToValidate="txtSupportid"  ValidationGroup="First"  ErrorMessage="Enter only Numbers"></asp:RegularExpressionValidator>--%>
                     </td>
               </tr>
               </div>
                <div id="divTypedescription"  runat="server">
               <tr>
                     <td><asp:Label ID="lblDescription" Text="Description" runat="server"></asp:Label></td>
                     <td><asp:TextBox ID="txtDescription" runat="server"></asp:TextBox></td>
                     <td><asp:Label ID="Label3" runat="server" Text="*" style="color:Red"></asp:Label></td>
               </tr>
               </div>

               <tr>
                     <td><asp:Label ID="lbldate" Text="Date" runat="server"></asp:Label></td>
                     <td><asp:TextBox ID="txtDate" runat="server" Enabled="False"></asp:TextBox></td>

                     <td></td>
               </tr>
               <tr>
                     <td><asp:Label ID="lbleffort" Text="Effort" runat="server"></asp:Label></td>
                     <td><asp:TextBox ID="txtEffort" runat="server" Width="30%"></asp:TextBox>
                     <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server"
                           ControlToValidate="txtEffort" ValidationExpression="^[0-9]*$"  ErrorMessage="Enter only Numbers" EnableViewState=true> </asp:RegularExpressionValidator></td>
                     <td><%--<asp:Label ID="Label4" runat="server" Text="* in Hrs" style="color:Red"></asp:Label>--%>

                     </td>
               </tr>

               <tr >

                   <td ><asp:Button ID="btnSubmit" Text="SUBMIT" runat="server"
                           onclick="btnSubmit_Click" /></td>

                   <td> <asp:Button ID="btnCancel" Text="CANCEL" runat="server"
                           onclick="btnCancel_Click"  CausesValidation="false"/></td>
                           <td></td>

<%--<asp:ValidationSummary ID="ValidationSummary" ShowSummary="False" ValidationGroup="First" ShowMessageBox="True" runat="server" />--%>
               </tr>

               <tr>
                    <td colspan="2"><asp:Label ID="lblInsinfo" runat="server" ForeColor="#FF3300"></asp:Label> </td>
               </tr>
           </table>
         </div>
   </ContentTemplate>
   </asp:UpdatePanel>
             <%--<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"
                   DisplayAfter="0" DynamicLayout="true">
                   <ProgressTemplate>
                       <div id="ProgressBar" class="ajax-loading">
                       Working on your request...</div>
                   </ProgressTemplate>
               </asp:UpdateProgress>--%>
   </asp:Panel>
Posted

1 solution

Check whether you have added
C#
<asp:scriptmanager id="ScriptManager1" runat="server"  />


And also remove
UpdateMode="Conditional"
from the UpdatePanel.

Here is the complete guide about UpdatePanel:

http://www.asp.net/ajax/documentation/live/overview/updatepaneloverview.aspx[^]

I hope this will help to you.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900