当前位置:编程学习 > C#/ASP.NET >>

OnRowDeleting事件不被调用

首先我在一个页面里用showModalDialog打开了一个页面在这个打开的页面里我查询了一张表,并修改一些数据后。我要点击一个按钮来返回给第一个页面。而返回数据方法我写在了OnRowDeleting事件中。为什么当点击按钮它会重新弹出一个新页面儿不是关闭当前页面并返回值呢
这是GridView的代码。
<asp:GridView ID="SearchResult" runat="server" AutoGenerateColumns="False" 
            BorderStyle="None" BorderWidth="1px" CellPadding="4" Width="538px" 
            ForeColor="#333333" GridLines="None" OnRowDeleting="Result_RowDeleting" DataKeyNames="xiema,Quantity">
            <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
                <Columns>
                   <asp:TemplateField HeaderText="鞋码编号">
                        <ItemTemplate>
                            <asp:Label ID="id" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
                        </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="商品尺码">
                        <ItemTemplate>
                            <asp:Label ID="xiema" runat="server" Text='<%# Eval("Xiema") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="数量">
                    <ItemTemplate>
                        <asp:TextBox ID="Quantity" runat="server" Text='<%# Eval("Quantity") %>'></asp:TextBox>
                   </ItemTemplate>
                 </asp:TemplateField>
                <asp:CommandField DeleteText="<img border=0 src=../images/Select.gif />" ShowDeleteButton="True" />
               </Columns>
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
           <AlternatingRowStyle BackColor="White" />
       </asp:GridView>
这是OnRowDeleting事件代码
 protected void Result_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string xiema = SearchResult.DataKeys[e.RowIndex]["xiama"].ToString();
        string Quantity = SearchResult.DataKeys[e.RowIndex]["Quantity"].ToString();
        Jscript.CloseWindowReturnValues1(xiema + "$$$" + "数量" + Quantity);
        return;
    }
这是Jscript中的CloseWindowReturnValues1代码
 public static void CloseWindowReturnValues1(string value)
        {
            System.Text.StringBuilder Str = new System.Text.StringBuilder();
            Str.Append("<Script language='JavaScript'type=\"text/javascript\">");
            Str.Append("var str='" + value + "';");
            Str.Append("top.returnValue=str;");
            Str.Append("top.close();</Script>");

            HttpContext.Current.Response.Write(Str.ToString());
            HttpContext.Current.Response.End();
        }
--------------------编程问答-------------------- 打断点看进去方法没!! --------------------编程问答-------------------- 打了。根本不进Result_RowDeleting方法 --------------------编程问答-------------------- 事件没挂接吧 --------------------编程问答-------------------- 件没挂接吧??我小白。不明白什么意思! --------------------编程问答-------------------- 帮帮忙啊。。。。 --------------------编程问答-------------------- 求高手。。。我在线等。。!!
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,