开发者

Avoid Page refresh

开发者 https://www.devze.com 2023-03-20 22:03 出处:网络
Hi I\'m using the two RadDateTimePickers for start and enddates in my asp.net application. I\'m implemeting the selecteddatechanged events.

Hi I'm using the two RadDateTimePickers for start and enddates in my asp.net application. I'm implemeting the selecteddatechanged events. Because If both dates selected I will enable button.

Whenever I selected the date e开发者_Go百科very time page is refreshing. So I'm loosing the previous. result. I have placed the whole code in asp updatepanel but page result is not showing. How can I solve this?


Check the AutoPostBackControl property to see if you are posting back.

It looks like you are trying to use a server side event.

I don't fully understand your scenario but It looks like you would be better served using a client-side event. RadDateTimePicker has OnDateSelected. On the most recent version of RadControls

 ClientEvents-OnDateSelected

you could then have both pickers run javascript to check if both pickers have a selected date.

<script type="text/javascript">

    function StartPicker_DateSelected(s, e) {
        checkDates();
    }

    function EndPicker_DateSelected(s, e) {
        checkDates();
    }

    function checkDates() {
        var start = $find('<%= startPicker.ClientID %>').get_selectedDate();
        var end = $find('<%= endPicker.ClientID %>').get_selectedDate();

        if (start && end) {
            //enable Button
            alert('button enabled');
        }

    }
</script>

    <telerik:RadDateTimePicker ID="startPicker" runat="server" ClientEvents-OnDateSelected="StartPicker_DateSelected">
    </telerik:RadDateTimePicker>
    <telerik:RadDateTimePicker ID="endPicker" runat="server" ClientEvents-OnDateSelected="EndPicker_DateSelected">
    </telerik:RadDateTimePicker>
0

精彩评论

暂无评论...
验证码 换一张
取 消