I have a situation where i have to call radconfirm on clicking a server side asp button. Based on the confirm output i have to decide whether to copy or don't copy. By reading several forums i have seen something like this shown below :
'
function ValidateFn() {
radconfirm("sure?", callbackFn);
return false;
}
function callbackFn(arg) {
//if the validation passes - 'simulate' the button's click
if (arg) {
__doPostBack("<%= CopyButton.ClientID %>", "");
}
}
<asp:Button OnClientClick="ValidateFn(); return false;" >
This works fine with popup and the page gets reloaded completely again as we do a postback. But i have a ajax stuff where i need to avoid this postback
my code snippet is given below
.aspx
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<telerik:RadAjaxPanel runat="server" ID="AjaxPanel" LoadingPanelID="AjaxLoadingPanel">
<telerik:RadSplitter ID="SplitPane" runat="server" height="400px" Width="600px" Skin="Vista">
<telerik:RadPane id="TreePane" runat="server" height="400px" Width="300px" BackColor = "White">
<telerik:RadTreeView runat="server" id="TreeView1" Skin="Vista"
OnNodeExpand="TreeView1_NodeExpand" CheckBoxes = "true"
LoadingMessage = "loading..."></telerik:RadTreeView>
</telerik:RadPane>
<telerik:RadPane ID="buttonpane" runat="server" height="400px" width="310px" >
<asp:Button ID="CopyButton" runat="server" Text="Copy" OnClick="CopyButton_Clicked"/>
.....more buttons
</telerik:radPane>
</telerik:RadSplitter>
<div>
<asp:Label CssClass="WarningLabel" id="StatusLabel" runat="server"></asp:Label>
</div>
</telerik:RadAjaxPanel>
<telerik:RadAjaxManager ID="RadAjaxMgr" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="CopyButton">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="CopyButton" />
<telerik:AjaxUpdatedControl ControlID="StatusLabel" />
<telerik:AjaxUpdatedControl ControlID="AjaxPanel" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadWindowManager ID="RadWindowMgr" runat="server" Skin="Vista"></telerik:RadWindowManager>
.cs
protected void CopyButton_Clicked(object sender, EventArgs e)
{
if (CmsTreeView.CheckedNodes.Count <= 0)
{
// To show popup later
string scriptstring = "radalert('select a destination to copy', 330, 210);";
ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", scriptstring, true);
//StatusLabel.Text = "select a destination to copy";
return;
}
else
{
// proceed with copy functionality logic
}
}
On button click i need the radconfirm popup and when the users selects ok then it shud come here and check the nodes count and rest will go as usual. If i used the _postback the entire page loads which i don't want. So how to handle this scenario. Please let me know.
Regards,
Elango