你这是Web应用。你这种功能不可能实现。当你实现弹出对话框的时候,这一次请求就已经结束。下一次请求不会从弹出对话框的位置继续执行。

解决方案 »

  1.   

    webform,用js写个相应的方法,然后指定onclick事件。判断的话用confirm
    winform,if (MessageBox.Show("确定", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
    {
        //do sth
    }
    else
    {
    return;
    }
      

  2.   

    JS操作
    Confirm("你确定要怎的?");如果是服务端控件:OnClientClick
      

  3.   

    在page_onload事件里给你要点击的按钮添加如下属性
     this.SubmitButton.Attributes.Add("onclick", "return confirm('你确定提交吗?');");
      

  4.   

    一、使用GridView控件
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                                    CellPadding="4" Font-Size="9pt" ForeColor="#333333" GridLines="None" OnPageIndexChanging="GridView1_PageIndexChanging"
                                                    OnRowDataBound="GridView1_RowDataBound" OnRowDeleting="GridView1_RowDeleting"
                                                    Width="500px">
                                                    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                                    <RowStyle BackColor="#E3EAEB" />
                                                    <Columns>
                                                        <asp:BoundField DataField="ST_l_id" HeaderText="地址ID" />
                                                        <asp:BoundField DataField="ST_l_name" HeaderText="网站名称" />
                                                        <asp:BoundField DataField="ST_l_url" HeaderText="链接网址" />
                                                        <asp:HyperLinkField DataNavigateUrlFields="ST_l_id" DataNavigateUrlFormatString="AmendLink.aspx?ID={0}"
                                                            HeaderText="修改" Text="修改" />
                                                        <asp:CommandField HeaderText="删除" ShowDeleteButton="True" />
                                                    </Columns>
                                                    <SelectedRowStyle BackColor="#C5BBAF" ForeColor="#333333" Font-Bold="True" />
                                                    <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                                                    <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                                    <EditRowStyle BackColor="#7C6F57" />
                                                    <AlternatingRowStyle BackColor="White" />
                                                </asp:GridView>
    二、处理程序如:
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
    SqlData da = new SqlData();
            da.ExceSQL("delete from ST_link where ST_l_id='" + GridView1.DataKeys[e.RowIndex].Value + "'");
    Page.Response.Redirect("LinkManage.aspx"); 
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
    GridView1.PageIndex = e.NewPageIndex;
    GridView1.DataBind();//CodeGo.net
    } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
    if ((e.Row.Cells[1].Text).Length > 6)
    {
    e.Row.Cells[1].Text = (e.Row.Cells[1].Text).Substring(0, 6) + "…";
    }
    if ((e.Row.Cells[0].Text).Length > 6)
    {
    e.Row.Cells[0].Text = (e.Row.Cells[0].Text).Substring(0, 6) + "…";
    }
    if ((e.Row.Cells[0].Text).Length > 6)
    {
    e.Row.Cells[0].Text = (e.Row.Cells[0].Text).Substring(0, 6) + "…";
    }
    }
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
    ((LinkButton)(e.Row.Cells[4].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
    }