2014-11-25 96 views
0

不同的警報消息你好傢伙我在我的asp.net網站上使用gridview(從obout)。當用戶點擊編輯時,griview打開並顯示點擊行的模板。在那裏我有一個保存按鈕。當用戶點擊它時,我得到一個簡單的JS腳本,彈出一個簡單的警報。 我的問題是,現在我需要在不同情況下顯示不同的警報。 我試圖把該上的更新,而不是事件,但它不會觸發:gridview更新

Page.ClientScript.RegisterStartupScript(Me.GetType(), "PopUpWindow", popupscript, False) 

我想找到我怎麼能對警報更新事件後,用戶將看到完全控制。

回答

0

你可以處理GridView的RowDataBound事件,嘗試使用這個js功能的onclick

protected void Gridview_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
if (e.Row.RowType == DataControlRowType.DataRow) 
{ 
    // reference the Delete LinkButton 
    LinkButton db = (LinkButton)e.Row.Cells[3].Controls[0]; 

    db.OnClientClick = "return confirm('Are you certain you want to delete this questionnaire?');"; 
} 
} 

(OR)

HERE