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

Confirmation Message on Grid row update

7 Answers 519 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Parth
Top achievements
Rank 1
Parth asked on 09 Sep 2010, 04:42 PM
Hello,

I want to popup confirmation dialog to the user to update the record in the telerik grid. I have the editform mode of editing the record.
How can I add javascript for it?

Can anyone help me out on this issue.

<MasterTableView CommandItemDisplay="Top" DataKeyNames="brandid"
    EditMode="EditForms" AutoGenerateColumns="False" Width="100%">
    <CommandItemTemplate>
    <div style="padding:10px 0px;">
       <asp:LinkButton ID="btnUpdateEdited" runat="server"                    
             CommandName="UpdateEdited"
              Visible='<%# gridBrands.EditIndexes.Count > 0 %>'>
          <img style="border:0px;vertical-align:middle;" alt=""
               src="../Images/Update.gif" /> Update Record
           </asp:LinkButton
    </div>
     </CommandItemTemplate>
     <Columns>
    <telerik:GridEditCommandColumn ButtonType="ImageButton"
           EditImageUrl="~/images/Edit.gif" UniqueName="EditCommandColumn">
        <ItemStyle CssClass="MyImageButton" />
    </telerik:GridEditCommandColumn>
     </Columns>
</MasterTableView>

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Sep 2010, 06:19 AM
Hello Parth,

        If you want to show the conformation message for the button (btnUpdateEdited) in CommandItemTemplate, you can directly set it in the markUp like below.

MarkUp:
<CommandItemTemplate>
    <asp:LinkButton ID="btnUpdateEdited" runat="server"                
             CommandName="UpdateEdited" Visible='<%# gridBrands.EditIndexes.Count > 0 %>' OnClientClick="javascript:return confirm('Do you want to update your record!!?')>
          <img style="border:0px;vertical-align:middle;" alt=""
               src="../Images/Update.gif" /> Update Record
           </asp:LinkButton>
</CommandItemTemplate>

 
In order to show confirmation dialog for edit button, try the following approach.

Mark-Up:
<ClientSettings>
           <ClientEvents OnCommand="OnCommand" />
 </ClientSettings>

JavaScript::
<script type="text/javascript">
function OnCommand(sender,e)
{
 
if(e.get_commandName()=="Edit")
{
confirm("Do you want to update your record!!");
}
}
</script>

Regards,
Shinu.
0
Parth
Top achievements
Rank 1
answered on 10 Sep 2010, 03:46 PM
Shinu,

I don't have the OnCommand option in the client events in my version.

Is there any workaround for this ?

Thanks,
Parth
0
Tsvetina
Telerik team
answered on 10 Sep 2010, 03:58 PM
Hi Parth,

I can see that in the ticket information you specified that you are using the latest version of RadControls for ASP.NET AJAX. Could you please confirm that it is so, or if not, let us know what version are you using?

Greetings,
Tsvetina
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
0
Parth
Top achievements
Rank 1
answered on 10 Sep 2010, 04:03 PM
Hi,

I am using version 2008.1.619.35

Thanks,
0
Tsvetina
Telerik team
answered on 13 Sep 2010, 12:26 PM
Hi Parth,

In this case, since the OnCommand client-side event is not exposed in your version of RadControls, you can use the first piece of code which Shinu offered, as it relies only on a simple onclick event.
 
All the best,
Tsvetina
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
0
Parth
Top achievements
Rank 1
answered on 15 Sep 2010, 01:17 PM
Hello,

If I will use the onclientclick event than it will be available only with the update button on the commanditem in the grid.

What I want is when I click on edit it will open the record in editform mode. At that time we have 2 buttons.
1. Update
2. Cancel

I want the confirmation dialog on this update button.

Any help will be apreciated.

Thanks.
Parth    
0
Tsvetina
Telerik team
answered on 15 Sep 2010, 01:47 PM
Hello Parth,

You could try creating a Form Template edit form and attach the javascript to the button in this template (which would be exactly the Update button which you have in mind).

Regards,
Tsvetina
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
Tags
Grid
Asked by
Parth
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Parth
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or