G
Guest
I have read an article on the web. And There is the source.
I get an error when I'm using this:
private void DataGrid1_ItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType lit = e.Item.ItemType;
if (lit == ListItemType.Item)
{
Button btnDelete = (Button) e.Item.FindControl("Delete");
btnDelete.Attributes.Add("OnClick", "javascript: return confirm('Are you
sure you want to delete this record?');");
}
}
Aspx
<asp:ButtonColumn Text="Remove" ButtonType="PushButton" CommandName="Delete">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" Width="50px"></ItemStyle>
</asp:ButtonColumn>
Who can tell me why this code doesnt work?
I get an error when I'm using this:
private void DataGrid1_ItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType lit = e.Item.ItemType;
if (lit == ListItemType.Item)
{
Button btnDelete = (Button) e.Item.FindControl("Delete");
btnDelete.Attributes.Add("OnClick", "javascript: return confirm('Are you
sure you want to delete this record?');");
}
}
Aspx
<asp:ButtonColumn Text="Remove" ButtonType="PushButton" CommandName="Delete">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" Width="50px"></ItemStyle>
</asp:ButtonColumn>
Who can tell me why this code doesnt work?