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

[Solved] Button doesn't fire an event on click

5 Answers 182 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Elena Lavrinenko
Top achievements
Rank 1
Elena Lavrinenko asked on 26 Sep 2009, 12:17 PM
In Multipage RadPageView control I use server validation. When I set button's property to 'causesvalidation=true'
<telerik:RadPageView runat="server" ID="CMPageView" Width="460px">  
        <div class="viewWraptabs tabposition arial">  
            <class="red">Date: <%=DateTime.Now.ToShortDateString() %></p>  
             <uc2:ssncontrol id="ssn" runat="server" controlposition="16,65" tbwidth="155px"/>  
             <asp:requiredvalidator id="rvdob" runat="server" controltovalidate=="RadDatePicker1" errormessage="dob is required"/>    
            <span class="positionT arial">Date of Birth*: </span> 
            <telerik:raddatepicker id="RadDatePicker1" runat="server" skin="Black" cssclass="positionTD" width="130px" calendar-rangemindate="1/1/1940 12:00:00 AM" mindate="1/1/1940 12:00:00 AM"  dateinput-mindate="1/1/1940 12:00:00 AM" /> 
                        <span class="positionS arial">Have you ever had an accident:<span class="space80"></span> <asp:checkbox id="cbacc" runat="server"/></span> 
            <span class="positionSD arial">Have you ever been charged<br /> with a violation?<span class="space50"></span><asp:checkbox id="cbv" runat="server"/></span> 
               
             <textarea id="taacc" cols="30" rows="5" class="positionF" runat="server" validateemptytext="true" validationgroup="mmm"></textarea> 
               
            <textarea id="taviol" cols="30" rows="5" class="positionFD" runat="server"></textarea> 
            <div style="background: url(Img/bg.gif) no-repeat; width: 600px; height: 362px; padding-top: 24px;  
            text-align: center;position:absolute;left:150px;top:290px"> 
<asp:Button Text="Add Member Info" OnClick="AddMemberInfo_Click" runat="server" ID="bmember" 
Style="width: 116px;" causesvalidation="true" usesubmitbehavior="true"></asp:Button> 
<asp:Button Text="Cancel"  runat="server" ID="bcancel" causesvalidation="false" 
Style="width: 116px;"></asp:Button> 
</div> ...etc...
</telerik:RadPageView>
 
, events are not fired anymore. When I turn validation off, event is firing on click. How I can resolve this issue?

I forgot to mention that this is happening on second page. With first page everything is fine. I use multiple pages for tabstrip.

5 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 28 Sep 2009, 09:02 AM
Hello Elena,

The default value of RequiredFieldValidator.EnableClientScript is "true" so if you leave the RadDatePicker empty you should get the error message next to it when clicking the "Add member info" button (in case you have Javascript enabled on your browser). Now the server side event of the button will not fire. However if you select any date and then press the button the should fire.
To stop the client-side validation just set RequiredFieldValidator.EnableClientScript="false".

I hope this helps.

Regards,
Martin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Elena Lavrinenko
Top achievements
Rank 1
answered on 28 Sep 2009, 12:06 PM
That' is the problem. I think I mentioned that/. The page is valid. Validators are only requiredvalidators, which don't require client side functions, but button doesn't fire/  The strange workaround was - to wrap the page into control and put it under radpageview page
0
Martin
Telerik team
answered on 01 Oct 2009, 07:55 AM
Hello Elena,

Based on the code from your first post I built a sample demo project that runs as expected on my side.

I hope this helps.

Regards,
Martin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Elena Lavrinenko
Top achievements
Rank 1
answered on 06 Oct 2009, 01:04 AM
Martin, sorry for late reply. I had some vacations.And I very appreciate your help.
In your example my buttons are also fired. The problem happens for the set of buttons for the next tab in tabstrip. I found the workaround naming them the same as first buttons.
And right now I have problems with dropdown and other linkbuttons, that is also doesn't fire event 'onselected indexchanged'. I think that my ajax settings are somehow wrong.
</telerik:radcodeblock> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="bmember">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="InnerContainer " LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="CbSelect">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGridTraining" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
 
I think that tabstrip somehow catches the request and these events are useless. What is wrong with this? I forgot to mention that I set tabstrip causesvalidation property to false.
0
Martin
Telerik team
answered on 07 Oct 2009, 02:55 PM
Hello Elena,

I looked through the AJAX settings and they looks fine. However from your posts I am not bale to reproduce your scenario.
I modified the sample project and now it includes a RadTabStrip control. Please note that I set EnableClientScript = "false" because on initial load the RadDatePicker has an empty value set, and consequently the validator controls will not let you navigate through the tabs. Another option might be setting valid values to the pickers on their initial load.

I hope this helps

Regards,
Martin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Elena Lavrinenko
Top achievements
Rank 1
Answers by
Martin
Telerik team
Elena Lavrinenko
Top achievements
Rank 1
Share this question
or