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

Commanditem button as RadWindow opener

4 Answers 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 2
Iron
Iron
Veteran
Fit2Page asked on 15 Mar 2017, 01:16 PM

When I have a button in RadGrid commanditem as follows:

    <CommandItemTemplate>
        <div><asp:Button ID="btn_stats" runat="server" Text="Omzet statistieken"></asp:Button></div>
    </CommandItemTemplate>

 

And I want to use that button as RadWindow opener like:

    Protected Sub dtgProducts_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs)
        If TypeOf e.Item Is GridCommandItem Then

            Dim commandItem As GridCommandItem = CType(e.Item, GridCommandItem)
            Dim button As Button = CType(commandItem.FindControl("btn_stats"), Button)

            ViewState("statsopener") = button.ClientID
            rw_Stats.OpenerElementID = button.ClientID
        End If

    End Sub

I try to assure the OpenerElementID on paging the RadGrid like:

    Protected Sub dtgProducts_PageIndexChanged(sender As Object, e As GridPageChangedEventArgs)

        dtgProducts.MasterTableView.Columns(1).HeaderText = ViewState("statsopener")
        'dtgProducts.AllowPaging = False
        rw_Stats.OpenerElementID = ViewState("statsopener")

    End Sub

 

But the button does not open the RadWindow after paging the grid.

Please assist.

 

Marc

 

4 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 20 Mar 2017, 07:24 AM
Hi Marc,

RadGrid already provides confirmation functionality. You can use GridButtonColumn to achieve this requirement automatically:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/delete-records/adding-a-delete-confirmation

In addition, I am also attaching a sample RadGrid web site to demonstrate more advanced implementation. 
‚Äč

Alternatively, if you want to implement a custom approach, you can use GridTemplateColumn and place a Button in its ItemTemplate.

If you want to delete the row only visually on the client, you can use a GridClientDeleteColumn.

NOTE: 

There is a bug in version R1 2017 - DeleteCommand event does not fire with  ConfirmDialogType="RadWindow". You can try to upgrade to version 2017 R1 SP1 to resolve the issue.

Alternatively, you can remove the ConfirmDialogType property and use the default window confirmation:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

I hope this will prove helpful.

Regards,
Eyup
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 20 Mar 2017, 07:42 AM

Hi Eyup,

 

My scenario is not based on a RadGrid column command, but on a button in the

 

<CommandItemTemplate>
        <div><asp:Button ID="btn_stats" runat="server" Text="Omzet statistieken"></asp:Button></div>
    </CommandItemTemplate>

 

Please refer to the code I sent you in my first post.

 

Marc

0
Accepted
Eyup
Telerik team
answered on 22 Mar 2017, 05:04 PM
Hello Marc,

When developing your app, we highly recommend you to ensure that the functionality works without adding AJAX. Please temporarily disable any AJAX on the page if present (RadAjaxManager, RadAjaxPanel, UpdatePanel, etc.) and enable your script debugger (FireBug or F12) to see whether there are any script or server errors interfering, and make sure that the application works without AJAX.

Also, you can check this article:
http://docs.telerik.com/devtools/aspnet-ajax/controls/window/troubleshooting/opening-from-the-server

If the issue remains, please open a formal support ticket and send us a very basic version of your application for further investigation.

Regards,
Eyup
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 23 Mar 2017, 08:28 AM

This solution does the trick:

 

http://docs.telerik.com/devtools/aspnet-ajax/controls/window/troubleshooting/opening-from-the-server

 

Thanks Eyup!

Tags
Grid
Asked by
Fit2Page
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Eyup
Telerik team
Fit2Page
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or