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

Radconfirm on server click event

2 Answers 243 Views
Window
This is a migrated thread and some comments may be shown as answers.
Elango
Top achievements
Rank 1
Elango asked on 12 Sep 2008, 10:49 PM
Hello,
       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

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 16 Sep 2008, 01:06 PM
Hi Elango,

This task is not related to the RadWindow control - it is a general ASP.NET issue (submitting information from the client to the server) and there are various approaches that depend on the exact case. For example if you are using RadAjax, you can use ajaxRequest.


All the best,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Elango
Top achievements
Rank 1
answered on 18 Sep 2008, 04:19 PM
Hi Georgi,
       Thanks for your reply. I will check the ajaxrequest stuff.

Regards,
Elango
Tags
Window
Asked by
Elango
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Elango
Top achievements
Rank 1
Share this question
or