0
我正在使用下面的C#從GridViews上的命令行中替換文本的「編輯,刪除和選擇」。C#CommandRow LinkButton添加Javascript
我想通過使用一個JavaScript'確認'對話框來提高這一點,使用戶在刪除行之前進行雙重檢查。我如何從LinkButton對象執行此操作?
private void commandIcons(GridViewRow row)
{
if (row.Cells[0].Controls.Count == 5)
{
// we have a edit delete select control row type, replace text labels with icons
LinkButton lbedit = (LinkButton)row.Cells[0].Controls[0];
lbedit.Text = lbedit.Text == "Edit" ? "<img title=\"Edit\" class=\"icon\" src=\"Images/database_edit.png\" />" : lbedit.Text;
LinkButton lbdelete = (LinkButton)row.Cells[0].Controls[2];
lbdelete.Text = lbdelete.Text == "Delete" ? "<img title=\"Delete\" class=\"icon\" src=\"Images/delete.png\" />" : lbdelete.Text;
LinkButton lbselect = (LinkButton)row.Cells[0].Controls[4];
lbselect.Text = lbselect.Text == "Select" ? "<img title=\"Select\" class=\"icon\" src=\"Images/accept.png\" />" : lbselect.Text;
}
}
完美,OnClientClick這個正是財產我了! – deed02392 2012-02-01 10:58:13
好聽,自己在所有的aspx頁面中使用它。很高興我能幫忙 – DerDee 2012-02-01 11:01:52