I have a Telerik AJAX Radtoolbar act against a RadGrid. I have code behind to do something when I click items on the ToolBar base on row selected in the grid, but before the post back, I need some client side validation, post back won't happen if validation fails. I tried to use
However, this causes the RadToolBar unclickable and even jam all other AJAX functions on the page. if I changed the OnClientClicked to "
Are there any other ways that I can work around or did I miss something using this method?
Thanks!
<telerik:RadToolBar runat="server" Width="100%" ID="RadToolBar1" EnableRoundedCorners="true" OnClientButtonClicked="javascript:if(!PageValidation()){return false;}" OnButtonClick="RadToolBar1_ButtonClick" EnableShadows="true" Skin="Office2007" Height="27px" AutoPostBack="false"> <Items> <telerik:RadToolBarButton Text="Export" Value="1" PostBack="true" /> <telerik:RadToolBarButton IsSeparator="true" />function PageValidation() { var IsValid = false;
var error = document.getElementById("errorMsg"); var mastertableView = $find("<%= RadGrid1.MasterTableView.ClientID %>"); var count = mastertableView.get_selectedItems().length; if (count < 1) {
error.style.display = "inherit"; IsValid = false; } else {
error.style.display = "none"; IsValid = true; } return IsValid; }OnClientButtonClicked="PageValidation" ", the client side validation works with the error msg pop up but it cannot stop the post back. Are there any other ways that I can work around or did I miss something using this method?
Thanks!
