[英]Telerik RadGrid- Adding javascript method to GridEditCommandColumn
How can I add a javascript method to the update button of GridEditCommandColumn in Telerik RadGrid? 如何在Telerik RadGrid中的GridEditCommandColumn的更新按钮上添加JavaScript方法?
I need to fire a js method on the update button of EditCommandColumn. 我需要在EditCommandColumn的更新按钮上触发js方法。 I was able to add clientside event on the edit button but while clicking edit button it turns out to update and cancel.
我能够在“编辑”按钮上添加客户端事件,但是单击“编辑”按钮时,结果可以更新和取消。 I want to add a js method to this update button.
我想向此更新按钮添加一个js方法。
Please find the column in aspx page below 请在下面的aspx页中找到该列
Thank you very much in advance. 提前非常感谢您。
Thanks Sikandar. 谢谢西坎达。 I followed your answer to get the result I wanted.
我按照您的回答获得了想要的结果。
if (e.Item is GridDataItem && e.Item.Edit)
{
GridDataItem item = (GridDataItem)e.Item;
Button btn = (Button)item.FindControl("UpdateButton");
btn.Attributes.Add("OnClick", "return confirmBox();");
}
Try following code 尝试以下代码
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditColumn">
</telerik:GridEditCommandColumn>
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
If TypeOf e.Item Is GridDataItem Then
Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
DirectCast(item("EditColumn").Controls(0), ImageButton).Attributes.Add("onclick", "alert('test')")
End If
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.