5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 06 Mar 2009, 02:09 PM
Hi Mahesh,
You can use FormTemplate to achieve the desired scenario. Try with the following aspx code and see if it helps.
ASPX:
Thanks
Shinu
You can use FormTemplate to achieve the desired scenario. Try with the following aspx code and see if it helps.
ASPX:
<EditFormSettings EditFormType="Template" > |
<FormTemplate> |
<asp:LinkButton ID="LinkButton2" runat="server" OnClientClick="javascript:return confirm('Do you want to delete?')" >Delete</asp:LinkButton> |
</FormTemplate> |
</EditFormSettings> |
Thanks
Shinu
0
Mahesh
Top achievements
Rank 1
answered on 07 Mar 2009, 09:14 AM
Thanks Shinu.
It's working in template form.
You have shown how to create a link button.
But I am using popup as Edit-mode.In this case the delete button is autogenerated.
Can we create confirm window in popup/In place type.I think we have to find a delete button in edit form and then call a script.
What you say?
Thanks in advance.
-Mahesh.
It's working in template form.
You have shown how to create a link button.
But I am using popup as Edit-mode.In this case the delete button is autogenerated.
Can we create confirm window in popup/In place type.I think we have to find a delete button in edit form and then call a script.
What you say?
Thanks in advance.
-Mahesh.
0
Shinu
Top achievements
Rank 2
answered on 09 Mar 2009, 06:42 AM
Hi Mahesh,
Try to find the delete button in the Popup edit form in the Itemcreated Event as shown below and attach the client event there.
Try to find the delete button in the Popup edit form in the Itemcreated Event as shown below and attach the client event there.
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) |
{ |
if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
{ |
if (!e.Item.OwnerTableView.IsItemInserted) |
{ //find the autogenerated delete button from the control collection and add the attribute.. |
LinkButton deleteButton = (LinkButton)e.Item.Control[0].....; |
deleteButton.Attributes.Add("onclick", "return alert('Do you want to delete?');"); |
} |
} |
} |
Give a try and let me know how it goes.
-shinu.
0
Mahesh
Top achievements
Rank 1
answered on 09 Mar 2009, 11:04 AM
Hi Shinu,
Thanks for reply.I think this will work.Meanwhile I changed my delete column and made it as button column.There we have Confirm text property.That's working fine.
But now I have problem for RadToolbar.In this toolbar I have 2 items as button.New and Delete.
Now I want to give confirm window for Delete button.
From the documents I understand that I have to call javascript.But there is no server side or client side event for Item Click.We have ToolBar Onclick event.So,
1)How I can differntiate new and delete?
2)I have server side code for delete.
If we return false from script then also my Server side event will fire If I am not wrong.
I want to avoid that.
3)How to call server side confirm window using Radwindow and get back message(Yes/No) from user as he/she click the confirm windows buttons?
Thanks in advance,
-Mahesh.
Thanks for reply.I think this will work.Meanwhile I changed my delete column and made it as button column.There we have Confirm text property.That's working fine.
But now I have problem for RadToolbar.In this toolbar I have 2 items as button.New and Delete.
Now I want to give confirm window for Delete button.
From the documents I understand that I have to call javascript.But there is no server side or client side event for Item Click.We have ToolBar Onclick event.So,
1)How I can differntiate new and delete?
2)I have server side code for delete.
If we return false from script then also my Server side event will fire If I am not wrong.
I want to avoid that.
3)How to call server side confirm window using Radwindow and get back message(Yes/No) from user as he/she click the confirm windows buttons?
Thanks in advance,
-Mahesh.
0
Shinu
Top achievements
Rank 2
answered on 10 Mar 2009, 08:40 AM
Hi Mahesh,
I hope you are trying to add RadWindow as the confirm window for the Toolbar button. If so try the following approach and see if it works.
ASPX:
JS:
You can also refer the following online demo.
Alert, Prompt, Confirm
Thanks
Shinu.
I hope you are trying to add RadWindow as the confirm window for the Toolbar button. If so try the following approach and see if it works.
ASPX:
<telerik:RadToolBar ID="RadToolBar1" OnClientButtonClicked="OnClientButtonClicked" runat="server"> |
<Items> |
<telerik:RadToolBarButton Text="New" ></telerik:RadToolBarButton> |
<telerik:RadToolBarButton Text="Delete" ></telerik:RadToolBarButton> |
</Items> |
</telerik:RadToolBar> |
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"> |
</telerik:RadWindowManager> |
JS:
<script type="text/javascript"> |
function OnClientButtonClicked(sender, args) |
{ |
var button = args.get_item(); |
if(button.get_text()=="Delete") |
{ |
radconfirm('Are you sure?'); |
} |
} |
</script> |
You can also refer the following online demo.
Alert, Prompt, Confirm
Thanks
Shinu.