This is a migrated thread and some comments may be shown as answers.
open radWindow in Grids event
5 Answers 40 Views
This is a migrated thread and some comments may be shown as answers.
Abhi Shinde
Top achievements
Rank 1
Abhi Shinde asked on 04 Dec 2011, 09:29 AM
Hi,
My radwindow is inside userControl named "showDetails.ascx" and that same usercontrol I have a grid.
In code behind of " "showDetails.ascx" On "grv_OnItemCommand" I need to open RadWindow Without page referesh.

showDetails.ascx
<telerik:RadWindowManager runat="server" ID="RadWindowManager1">
    <Windows>
        <telerik:RadWindow ID="radWinInvoiceDetails" runat="server" ShowContentDuringLoad="false"
            Width="400px" Height="400px" Title="Invoice Details" DestroyOnClose="true"
            Behaviors="Default">
            <ContentTemplate>
                <uc:MakePaymentControl ID="AnotherControl" runat="server" />
            </ContentTemplate>
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
 
 
 
<grid code----
<telerik:GridTemplateColumn HeaderText="Status">
                                    <ItemTemplate>
<asp:LinkButton ID="lnkStatus" runat="server" Text="Pay" CommandName="pay" CommandArgument='<%# Eval("PaymentID") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>

ShowDetails.ascx.cs
protected void grid_OnItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "pay")
            {
                string invoiceID = e.CommandArgument.ToString();
                ucMakePaymentControl.BindInvoiceDetails(Convert.ToInt64(invoiceID));
                radWinInvoiceDetails.VisibleOnPageLoad = true;
            }
        }

How can i open Radwindow on clientside/ without page refresh.
Thanks

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 05 Dec 2011, 06:26 AM
Hello,

One suggestion to achieve this scenario is you can add OnClientClick event of LinkButton and then open the window.

JS:
<script type="text/javascript">
   function OnClientClick()
   {
    var wd = window.radopen(null, "RadWindow1");
   }
</script>

Thanks,
Princy.
0
Abhi Shinde
Top achievements
Rank 1
answered on 05 Dec 2011, 04:02 PM
Hi prince,

Please look at my scenario. First I want to fill "<uc:MakePaymentControl ID="AnotherControl" runat="server" />"  which is in RadWidow.
So that is why i need to pass commandArgument on OnItemComman event.
protected void grid_OnItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "pay")
            {
                string invoiceID = e.CommandArgument.ToString();
                ucMakePaymentControl.BindInvoiceDetails(Convert.ToInt64(invoiceID));
                //radWinInvoiceDetails.VisibleOnPageLoad = true;
            }
        }


Is there any solution?
0
Marin Bratanov
Telerik team
answered on 06 Dec 2011, 05:04 PM
Hello Abhi,

If you need the server-side functionality I can suggest two options for this scenario:

1) follow the instruction from the following sticky thread to open the RadWindow from the code-behind: http://www.telerik.com/community/forums/aspnet-ajax/window/opening-radwindow-from-the-server.aspx.

OR

2) use AJAX - the button will perform an AJAX request that will update only the grid and will not dispose the RadWIndow or antything else that needn't be updated from the page, thus you can use its client-side click event to open the RadWindow as Princy suggested in his reply, just without cancelling the postback.


Best wishes,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Abhi Shinde
Top achievements
Rank 1
answered on 12 Dec 2011, 07:15 AM
Hi Marin,

I tried 1st scenario but page is refreshing,
But when I tried to use asp:update panel in grid button click is not working.
Please see the code

page.Ascx
<telerik:RadWindowManager runat="server" ID="RadWindowManager1">
    <Windows>
        <telerik:RadWindow ID="radWinInvoiceDetails" runat="server" ShowContentDuringLoad="false"
            Width="400px" Height="400px" Title="Invoice Details" DestroyOnClose="true" Behaviors="Default">
            <ContentTemplate>
                <uc:MakePaymentControl ID="ucMakePaymentControl" runat="server" />
            </ContentTemplate>
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
.
.
.
.
.

<
telerik:GridTemplateColumn HeaderText="Status">
                               <ItemTemplate>
                                   <asp:LinkButton ID="lnkStatus" runat="server" Text="Pay" CommandName="pay" CommandArgument='<%# Eval("ID") %>'></asp:LinkButton>
                               </ItemTemplate>
                           </telerik:GridTemplateColumn>

page.Ascx.cs
protected void grvInvoice_OnItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
       {
           if (e.CommandName == "pay")
           {
               string invoiceID = e.CommandArgument.ToString();
               ucMakePaymentControl.BindInvoiceDetails(Convert.ToInt64(invoiceID));
               string script = "function f(){$find(\"" + radWinInvoiceDetails.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
               ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);
 
           }
       }



I am waiting...
0
Marin Bratanov
Telerik team
answered on 13 Dec 2011, 04:45 PM
Hello Abhi,

Please note that when you click this button in the grid it will perform a postback which is the page refresh you are referring to. I assumed you are aware of this since you are already handling the grid's event in the code-behind.

As for using an update panel - things seem to be working fine on my end. I am also attaching my test page as a reference here. Please compare it with yours and try to locate any major differences in the setup. The only change I made is using Page instead of this in the RegisterStartupScript() method as it is better when using user controls.

All the best,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Asked by
Abhi Shinde
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Abhi Shinde
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or