This is a migrated thread and some comments may be shown as answers.

Validation problem when use RadAjaxManagerProxy on content page

4 Answers 34 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Sagar
Top achievements
Rank 1
Sagar asked on 22 Sep 2011, 02:40 PM
On my content page if I remove RadAjaxManagerProxy control then validations for controls on save button click works properly.but if I insert RadAjaxManagerProxy ,save button click does not validate any control.It comes to sever side save button click event.
I read about Page_ClientValidate() or Page_IsValid but it is not working.
Can u plz help me?
Sample code is as below -

<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="mvEmployment">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="mvEmployment" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rgPrepaidBenefits">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgPrepaidBenefits" />
                </UpdatedControls>
            </telerik:AjaxSetting>              
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>

Control to validate on Save button click -

<asp:TextBox ID="txtEmployer" CausesValidation="true" MaxLength="50" runat="server"
                            Width="200px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvEmployer" runat="server" ControlToValidate="txtEmployer"
                            ErrorMessage="Please Enter The Name" ToolTip="Please Enter The Name" ValidationGroup="Validatetest"
                            Display="Dynamic">*</asp:RequiredFieldValidator>
                        <ajaxtoolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server"
                            TargetControlID="rfvEmployer">
                        </ajaxtoolkit:ValidatorCalloutExtender>
                        <asp:RegularExpressionValidator ID="revEmployer" runat="server" ErrorMessage="Please insert alphabets."
                            ControlToValidate="txtEmployer" ValidationExpression="^[a-zA-Z]+$" ValidationGroup="Validatetest"
                            Display="Dynamic" Text="*"></asp:RegularExpressionValidator>
                        <ajaxtoolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender5" runat="server"
                            TargetControlID="revEmployer">
                        </ajaxtoolkit:ValidatorCalloutExtender>

Save Button -

 <asp:Button ID="rbtnSave" runat="server" CausesValidation="true"
                            Text="Save" ValidationGroup="Validatetest" OnClick="btnSave_Click" />

4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 22 Sep 2011, 08:35 PM
hello,

try with below code

  <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="rbtnSave">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="Panel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>


or

  <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="Panel1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="Panel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>


Note :put  textbox and their validators inside panel1.
You can also put savebutton inside panle1

Let me know if any concern.

Thanks.
Jayesh Goyani
0
Sagar
Top achievements
Rank 1
answered on 23 Sep 2011, 07:08 AM
Hi Jayesh,
Thanks for your rpy.but it is not working too.When I wrap my controls and there validators inside panel, it works weird.
When I click on Save button for first time,it still goes to server side event.then panel automatically gets hide.when I again click on save button then it won't fire server side event.means from second time it works accordingly but panel is not visible.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 23 Sep 2011, 07:39 AM
Hello Sagar,

please provide your code.

Thanks,
Jayesh Goyani
0
Sagar
Top achievements
Rank 1
answered on 24 Sep 2011, 08:23 AM
Hi Jayesh,
Thanks for rpy

I figured it out.
I used asp:MultiView named mvEmployment ,in my one View I've this text box and button.
In RadAjaxManagerProxy I've mention mvEmployment that't why it's giving me problem. when I removed it,validation works as expected.

but still I've one doubt
How can I ajaxify Multiview and at the same time able to perform validations then?
Tags
Ajax
Asked by
Sagar
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Sagar
Top achievements
Rank 1
Share this question
or