RadConfirm with grid itemdatabound

3 posts, 1 answers
  1. usr9999
    usr9999 avatar
    41 posts
    Member since:
    Jun 2010

    Posted 17 Jul 2010 Link to this post

    I have the following is my grid template column and the code behind grid databound and item command.

    How can i add radconfim to the same? When user chooses yes, i want the code in item command to execute. 

    <telerik:GridTemplateColumn UniqueName="Retrieve"> 

    <ItemTemplate><asp:LinkButton ID="lnkRetrieve" runat="server" CausesValidation="false" CommandArgument='<%# cstr(Eval("id"))%>'  CommandName="Retrieve" Text="Retrieve"></asp:LinkButton>

    Private Sub grd_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grd.ItemDataBound If TypeOf e.Item Is GridDataItem Then
    Dim llnkRetrieve As New LinkButton
      llnkRetrieve =
    CType(e.Item.FindControl("lnkRetrieve"), LinkButton)
    "onclick", "return confirm('Are you sure you want to retrieve?');")
    End If 

    End Sub




    Sub grd_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grd.ItemCommand
    If e.CommandName = "Retrieve" Then
    dim CommandArgument As String() = e.CommandArgument.ToString().Split(",")
    "ID") = CInt(CommandArgument(0))


    "Page.aspx", True) End If
    End Sub



  2. usr9999
    usr9999 avatar
    41 posts
    Member since:
    Jun 2010

    Posted 19 Jul 2010 Link to this post

    Help Please!-
  3. Answer
    Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 22 Jul 2010 Link to this post

    Hello usr9999,

    In order to get the desired result you should go through the following steps:

    1) Cancel the postback of the button (this is needed because the radconfirm does not block the thread) as shown below:

    llnkRetrieve.Attributes.Add("onclick", "confirm('Are you sure you want to retrieve?',  confirmCallBackFn);return false")

    2) Use a client javascript callback function as shown above

    3) Check the argument of in the callback and do the corresponding operation (e.g if you need to make a server call use the built-in javascript __doPostBack function as explained here: http://geekswithblogs.net/mnf/archive/2005/11/04/59081.aspx)

    Detailed help article about radconfirm and how to use it is available below:


    A sample demo is uploaded here:


    I hope that my explanations and the provided resources are helpful, let me know how it goes.

    Best wishes,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top