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

Add confirm to GridButtonColumn

3 Answers 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 01 Nov 2016, 02:25 PM

I've read several threads on this, but still cannot seem to get this to work.

I have a LogIn button on a RadGrid that I only want to have a confirmation on in a specific situation. I've tried several different ways, this seems to get the closest, but I am still not seeing the popup confirmation dialog. Any help is greatly appreciated.

Relevant code below.

 

    Protected Sub grdAccounts_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles grdAccounts.ItemDataBound

      If TypeOf e.Item Is Telerik.Web.UI.GridDataItem Then
            Dim item As Telerik.Web.UI.GridDataItem = DirectCast(e.Item, Telerik.Web.UI.GridDataItem)

            If ddlSiteType.SelectedValue.StartsWith("LIVE") Or ddlSiteType.SelectedValue.StartsWith("DR") Then
                Dim btnLogin As Button = CType(item("LogIn").Controls(0), Button)
                If btnLogin IsNot Nothing Then
                    btnLogin.Attributes.Add("ConfirmTitle", "Continue?")
                    btnLogin.Attributes.Add("ConfirmText", "You are entering a LIVE production site. Continue?")
                    btnLogin.Attributes.Add("ConfirmDialogType", "Classic")
                End If
            End If

...

End If

End Sub

 

3 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 02 Nov 2016, 04:03 PM
Anybody?
0
Richard
Top achievements
Rank 1
answered on 02 Nov 2016, 04:34 PM

This doesn't workl either.

    Protected Sub grdAccounts_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles grdAccounts.ItemDataBound
        If TypeOf e.Item Is Telerik.Web.UI.GridDataItem Then
            Dim item As Telerik.Web.UI.GridDataItem = DirectCast(e.Item, Telerik.Web.UI.GridDataItem)

            If ddlSiteType.SelectedValue.StartsWith("LIVE") Or ddlSiteType.SelectedValue.StartsWith("DR") Then
                Dim button As LinkButton = CType(item("LogIn").Controls(0), LinkButton)
                button.Attributes("onclick") = "return confirm('You are entering a LIVE Production Site. Do you want to continue?')"
            End If

0
Richard
Top achievements
Rank 1
answered on 02 Nov 2016, 07:38 PM
I figured it out, thanks though.
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or