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

want to show confirmation message on button click

1 Answer 240 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 07 Jan 2011, 04:51 PM
Hello in my grid i hv one button inside the grid ..

<telerik:GridTemplateColumn DataField="DelFlag" HeaderText="Status" SortExpression="DelFlag"
                            HeaderStyle-HorizontalAlign="Center" UniqueName="DelFlag" Visible="true" AllowFiltering="false">
                            <ItemTemplate>
                               <asp:Button ID="btnStatus" Font-Size="11px" Width="65px" runat="server" Text='<%#Eval("DelFlag")%>'
                                 CommandName="Command" />                                
                            </ItemTemplate>
                            <ItemStyle VerticalAlign="Middle" HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>

if user click on button want to show the message "Are you sure want's to change status?". if user click yes then update status otherwise not.

 Please find attached image file u get an idea.   In image file Status column that button .. on click on that button want to show the confirmation message.



thanks

1 Answer, 1 is accepted

Sort by
0
Mike Nogen
Top achievements
Rank 1
answered on 07 Jan 2011, 06:19 PM
Hello!

If you want an Grid out of the box soultion you can try using this.
<telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                 ConfirmTitle="Delete" ButtonType="PushButton" CommandName="Delete" Text="Delete"
                 UniqueName="DeleteColumn">
                 <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
             </telerik:GridButtonColumn>

You can find an example of this at the link below. Here they are using as a delete function.
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx

To add this confirmation funtion to your current solution would be to add an client side javascript that fires before the button event like this. (Think  is should havenĀ“t tried it within the Grid template column)
<asp:Button ID="btnStatus" onClientClick="return confirmation('Are you sure?')" Font-Size="11px" Width="65px" runat="server" Text='<%#Eval("DelFlag")%>'


/M
Tags
Grid
Asked by
Rahul
Top achievements
Rank 1
Answers by
Mike Nogen
Top achievements
Rank 1
Share this question
or