Validators inside Update Panel (VS2008)

I just noticed that if  I put validators inside update panels in Visual Studio 2008, they no longer function.  I must be missing something and I am sure this is an easy issue to deal with.  Can anyone give me any pointers here?

Thanks!
jglazer63Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

silemoneCommented:
this is a known error...and has always been the case


here a link that helps:

http://www.aspnettricks.com/archives/validators-inside-update-panel-doesnt-work-properly/
0
silemoneCommented:
just noticed you have vs2008..if you get vs2008 sp1, it's supposed to fix this...

http://stackoverflow.com/questions/124249/do-standard-asp-net-validators-work-with-ajax-and-update-panel
0
ajitha75Commented:
I tried this sample.. and it is working fine... Is there anything you have done? are both the controls and validators inside the updatepanel?

-Ajitha

        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox1" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="TextBox2" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
            </ContentTemplate>
        </asp:UpdatePanel>

Open in new window

0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

jglazer63Author Commented:
Well I updated to SP1 and i made no difference.  I am using a custom validator with a break point in the middle of it and its simply not firing.  I'll try putting the DLL in the BIN folder.
0
ajitha75Commented:
It depends on how the page is setup. Can you post your code here?
0
silemoneCommented:
if not...if its working before you place into update panel

do you have:

set the EnableClientScript property of the validators to false
0
jglazer63Author Commented:
Code is as follows.  Visibility of the chosen control is set to True at runtime.
   <asp:TextBox ID="txtCustomName" runat="server" Visible="False"></asp:TextBox>
                                    <asp:CustomValidator ID="CustomValidator1" runat="server" 
                                        ControlToValidate="txtCustomName" CssClass="fielderror" 
                                        ErrorMessage="Missing or Invalid Page Name" Display="Dynamic" 
                                        EnableClientScript="False"></asp:CustomValidator>
                                    <asp:CustomValidator
                                            ID="CustomValidator2" runat="server" 
                                        ErrorMessage="Page Already Exists" ControlToValidate="txtCustomName" 
                                        CssClass="fielderror" Display="Dynamic" EnableClientScript="False"></asp:CustomValidator>

Open in new window

0
ajitha75Commented:
How are you mapping the Validate event (OnServerValidate) with the handler? I dont see that in the html definition.
0
silemoneCommented:
he's using: ControlToValidate ajitha


could you leave visibility as True and try it?  see if it works when the textbox is visible from the onset...
0
jglazer63Author Commented:
I did try visiility to true with no difference.
0
ajitha75Commented:
ControlToValidate is fine. But since you are using a CustomValidator, to validate in server side, I suppose you have an handler, which should be fired during postback. Do you have that? how is that attached to the Control event?
0
jglazer63Author Commented:
Yea, its set in the events.
0
ajitha75Commented:
ok. can you share your .cs code then?
0
jglazer63Author Commented:
I did confirm that bysimply removing the updatepanel, it works perfecly fine.  If its inside, no go.  Does that help?  not sure what the .CS code is.
0
ajitha75Commented:
.cs is code behind code... like for ex. where are you setting the textbox visibility to true?

-Ajitha
0
silemoneCommented:
I think the problem is the visiblity at preinit...its not seen...therefore not attached to the validator...that's why it may be better to have everything visible at the beginning and set up through the control...make any other changes such as visibility in page load...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jglazer63Author Commented:
That worked.  Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.