亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Gridview的鏈接和刪除點(diǎn)擊提示的問題探討

 更新時(shí)間:2013年04月10日 16:27:39   作者:  
Gridview的鏈接和刪除點(diǎn)擊提示有利于提醒用戶確認(rèn)下操作是否正確,以免造成不必要的損失,感興趣的朋友可以參考下,希望對(duì)你有所幫助
例如:Gridview有取消和刪除兩列,點(diǎn)擊后提示一下再執(zhí)行。
復(fù)制代碼 代碼如下:

<asp:HyperLinkField DataNavigateUrlFields="id" DataNavigateUrlFormatString="HospitalView.aspx?id={0}" DataTextField="id" DataTextFormatString="取消" HeaderText="取消" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="60" ItemStyle-Width="60" />
<asp:CommandField ShowDeleteButton="True" DeleteText="刪除" HeaderText="刪除" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="60" ItemStyle-Width="60" />

如果在后臺(tái)這樣綁定提示:
復(fù)制代碼 代碼如下:

e.Row.Cells[6].Attributes.Add("onclick","return confirm ('您確認(rèn)要取消嗎? ')");
e.Row.Cells[7].Attributes.Add("onclick","return confirm ('您確認(rèn)要?jiǎng)h除這條數(shù)據(jù)嗎? ')");

這樣是給Gridview的單元格綁定事件,不點(diǎn)擊文字只要點(diǎn)擊文字所在的單元格,就會(huì)彈出提示,很不友好。
解決方法:
復(fù)制代碼 代碼如下:

((HyperLink)e.Row.Cells[6].Controls[0]).Attributes.Add("onclick","return confirm ('您確認(rèn)要取消嗎? ')");
((LinkButton)e.Row.Cells[7].Controls[0]).Attributes.Add("onclick","return confirm ('您確認(rèn)要?jiǎng)h除這條數(shù)據(jù)嗎? ')");

相關(guān)文章

最新評(píng)論