在RowCommand事件上确认消息。 [英] Confirm Message on RowCommand Event.
本文介绍了在RowCommand事件上确认消息。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的,
我有Dropdown& Gridview Row中的按钮。
我想从下拉菜单中选择一项。 &安培;修改它按行按钮点击。
我已经完成了。通过使用RowCommand事件。
但在此之前需要在点击按钮时发出提示信息。
提醒应为你确定要继续吗?
如果我点击是然后继续,否则退出命令。
提前感谢您。
代码在这里......
Dear All,
I have Dropdown & button in Gridview Row.
I would like to select one item from drop down. & fixed it on row button click.
Which i have already done.By using RowCommand Event.
But
prior to that it need to give alert message on button click.
alert should be "Are you sure to proceed?"
If I click yes then Proceed otherwise exit from command.
Thanking You in Advance.
code is here...
Private Sub JsAjaxWrite()
ScriptManager.RegisterStartupScript(Page, [GetType], "Key", jsScr, True)
End Sub
Protected Sub gvAssignmentSummuryAS_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvAssignmentSummuryAS.RowCommand
Try
'Find the row index of from where commnad has initiated to view the employee detail.
Dim i As Integer = Convert.ToInt32(e.CommandArgument)
'Find the control dropdown from gridview & set same in new control
Dim cboEmployeeNo As DropDownList = DirectCast(gvAssignmentSummuryAS.Rows(i).FindControl("cboEmployeeNo"), DropDownList)
If e.CommandName = "Assign" Then
If cboEmployeeNo.SelectedIndex = 0 Then 'If no value selected in dropdown then give alert.
jsScr = jsScr & "alert('Select Project Member to Assign.');"
JsAjaxWrite()
Exit Sub
End If
Dim rolecode As String = Convert.ToString(gvAssignmentSummuryAS.Rows(i).Cells(1).Text)
'txtDummyDepIdAS.Text = ("UPDATE ESUPPORT_MPA_ALLOCATION SET ALLO_EMP_CODE = " & cboEmployeeNo.SelectedValue & " WHERE ALLO_ROLE_CODE||0||ALLO_ROLE_SR_NO = '" & rolecode & "' AND ALLO_PROJ_JOB_CODE=" & cboProjCodeAS.SelectedValue & " AND ALLO_DEPT_CODE =" & cboDepartmentAS.SelectedValue & "")
If sei_helper.ExecuteNonquery("UPDATE ESUPPORT_MPA_ALLOCATION SET ALLO_EMP_CODE = " & cboEmployeeNo.SelectedValue & " WHERE ALLO_ROLE_CODE||0||ALLO_ROLE_SR_NO = '" & rolecode & "' AND ALLO_PROJ_JOB_CODE=" & cboProjCodeAS.SelectedValue & " AND ALLO_DEPT_CODE =" & cboDepartmentAS.SelectedValue & "") = 1 Then
jsScr = jsScr & "alert('Employee Assignment done successfully');"
JsAjaxWrite()
End If
If sei_helper.strErr <> "N" Then
ErrHnd()
End If
Catch ex As Exception
MessageBox(ex.Message)
End Try
End Sub
推荐答案
这就足够了我想,
this is enough i think,
<asp:TemplateField HeaderText="DELETE" HeaderStyle-BackColor="#8d3736" HeaderStyle-CssClass="gridheader">
<ItemTemplate>
<asp:ImageButton ID="ImageButton8" runat="server" CommandName="del"
ImageUrl="~/Images/delete.png"
<big> onclientclick="return confirm('Do You Want To Delete?')"</big>
onclick="ImageButton8_Click" />
</ItemTemplate>
<HeaderStyle BackColor="#8D3736" CssClass="gridheader"></HeaderStyle>
</asp:TemplateField>
using System.Windows.Forms;
dynamic result = MessageBox.Show("Are You Want To Cancle", "Your Website Name", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (result == DialogResult.No)
{
}
else if (result == DialogResult.Yes)
{
Response.Redirect("");
}
这篇关于在RowCommand事件上确认消息。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文