Web程序上怎么能用MessageBox呢?简直荒唐!

解决方案 »

  1.   

    学web开发先搞清什么是服务器端,什么是客户端;什么是http协议。
      

  2.   

    web里面使用的是alert,confirm等方法
      

  3.   

    你应该在绑定的时候加
    比如OnClientClick="return confirm('真的要删除?')"
      

  4.   

    <asp:GridView ID="GridView1" runat="server" 
                            AutoGenerateColumns="False" onrowcommand="GridView1_RowCommand" 
                                CellPadding="4" ForeColor="#333333" GridLines="None" Font-Size="12px" 
                                AllowPaging="True" PageSize="6" 
                                onpageindexchanging="GridView1_PageIndexChanging">
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <RowStyle BackColor="#EFF3FB" />
                            <Columns>
                                <asp:BoundField DataField="rid" HeaderText="rid">
                                    <ControlStyle CssClass="hidden" />
                                    <FooterStyle CssClass="hidden" />
                                    <HeaderStyle CssClass="hidden" />
                                    <ItemStyle CssClass="hidden" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="招聘主题">
                                    <ItemTemplate>
                                        <a target="_blank" href="../jobs/showjobs.aspx?rid=<%# Eval("rid") %>"><%# Eval("title") %></a>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="job" HeaderText="职位名称" />
                                <asp:BoundField DataField="city" HeaderText="工作地点" />
                                <asp:BoundField DataField="number" HeaderText="招聘人数" />
                                <asp:BoundField DataField="pay" HeaderText="薪资水平" >
                                    <HeaderStyle Width="80px" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="应聘人数">
                                    <ItemTemplate>
                                        <a href="toemploy.aspx?rid=<%# Eval("rid") %>"><%# Eval("applynum") %></a>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="添加时间">
                                    <ItemTemplate>
                                    <%#Common.TimeChange.ToSystemTime(Eval("addtime").ToString())%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="更新时间">
                                    <ItemTemplate>
                                    <%#Common.TimeChange.ToSystemTime(Eval("updatetime").ToString())%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:ButtonField CommandName="renew" Text="更新" />
                                <asp:ButtonField CommandName="amend" Text="修改" />
                                <asp:ButtonField CommandName="del" Text="删除" />
                            </Columns>
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <EditRowStyle BackColor="#2461BF" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("amend"))
            {
                Response.Redirect("updaterecruit.aspx?rid=" + GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].Text);
            }
            else if (e.CommandName.Equals("del"))
            {
                if (Wpk.updateRecruit(GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].Text) > 0)
                {
                    bind();
                }
            }
            else if (e.CommandName.Equals("renew"))
            {
                if (Wpk.updateRecruit(GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].Text,"0") > 0)
                {
                    bind();
                }
            }
            else { }
      

  5.   

    参见
    http://dotnet.aspx.cc/file/Add-confirm-dialog-with-ButtonField-Column-of-GridView.aspx
      

  6.   

     MessageBox.Show
    这个真不可以....
      

  7.   


    你这样试试
    MessageBox("xxxxx");
    ...................
      

  8.   

    ClientScript.RegisterStartupScript(this.GetType(), "message", " <script language='javascript' >if(Confirm('确认码?'))document.getElementById('"+Hf.ClientID+"').value='1'; else document.getElementById('"+Hf.ClientID+"').value='0'; </script>");  if(Hf.Value.Equals("1"))  
    {  }