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

.net弹出窗口上的按钮不响应

求助,用showModalDialog弹出的窗口上的有一颗按钮,有些时候点击按钮无法进入到其对应的响应事件中去,打断点也跟不进去,好像该事件根本就没被触发,请教高人!!!(我的弹出窗口是套模板做的不知道有没有影响) --------------------编程问答-------------------- ASP.NET(C#)技术联盟高级群,欢迎工作中的朋友进来一起探讨并解决工作中遇到的问题!一群37078937(已满)二群37078867三群37078820(欢迎上海地区的朋友)
严禁加多群,群定期清理长期不发言不讨论的朋友,请多包涵。 --------------------编程问答-------------------- 页面是不是加了uPdaePnal --------------------编程问答-------------------- 把代码贴出来看看吧,你是不是用了 ajaxcontroltokit的啊 --------------------编程问答-------------------- 恩,是使用了uPdaePnal,会有影响吗,下面是代码,还望各位高手赐教



--------------------编程问答-------------------- .aspx
<%@ Page Language="VB" MasterPageFile="~/Layout/RKMMaster.master" AutoEventWireup="false" CodeFile="CCMN03D001.aspx.vb" Inherits="CCMN03D001" Debug="true" Theme="defult"  ValidateRequest="false"%>
<%@ MasterType VirtualPath="~/Layout/RKMMaster.master" %>

<asp:Content ID="Content" ContentPlaceHolderID="ContentTripMaster" Runat="Server">
            <asp:UpdatePanel ID="uplSearch" UpdateMode ="Conditional" runat="server">
               <ContentTemplate> 
                 <div style="margin-top:0px; float:right; height: 35px; width : 450px; ">
                    <div style="margin-top:0px; float:left;width : 20px; ">
                    </div>
                    <div style="margin-top: 0px; float: left; width: 180px; font-size: 12pt;">
                        <asp:Label ID="lblGroupCd" runat="server" Text="<%$ Resources:NameResource, resBelongingCode %>" Font-Size="10pt"></asp:Label>
                    </div>
                    <div style="margin-top:0px; float:left; height: 35px; width : 200px; ">
                        <asp:TextBox ID="txtGroupCd" runat="server" AutoPostBack="True" TabIndex="3" 
                            MaxLength="16" />
                    </div>
                 </div>
                 <div style="margin-top:0px; float:right; height: 35px; width : 450px; ">
                    <div style="margin-top:0px; float:left;width : 20px; ">
                    </div>
                     <div style="margin-top: 0px; float: left; width: 180px; font-size: 12pt;">
                        <asp:Label ID="lblGroupNm" runat="server" Text="<%$ Resources:NameResource, resBelongingName %>" Font-Size="10pt"></asp:Label>
                    </div>
                    <div style="margin-top:0px; float:left; height: 35px; width : 200px; ">
                        <asp:TextBox ID="txtGroupNm" runat="server" AutoPostBack="True" 
                            MaxLength="32" />
                    </div>
                  </div>
                  <div style="margin-top:0px; float:right; height: 35px; width : 450px; ">
                        <div style="margin-top:0px; float:left;width : 350px; ">
                        </div>
                        <asp:Button ID="btnSearch" runat="server" 
                            Text="<%$ Resources:NameResource, resButtonSearch %>" TabIndex="4" />
                  </div>
              </ContentTemplate>
            </asp:UpdatePanel>
            <div style="margin-top:0px; float:left; width : 450px; ">
              <asp:UpdatePanel ID="uplDetil" UpdateMode ="Conditional" runat="server">
                <ContentTemplate> 
                    <div style="margin-top:0px; float:right; width :400px;" >
                        <div id="ScrollableGridViewHeaderDiv" style="margin-top: 3px; width:400px; float:left; overflow:hidden;">
                           <asp:GridView ID="grvHead" runat="server" ForeColor="#333333" Font-Size="10pt" 
                                AutoGenerateColumns="False" EnableViewState="False" ShowHeader ="true">
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <Columns>
                                            <asp:BoundField HeaderText="" DataField="Select" ReadOnly="True">
                                                <HeaderStyle Width="50px" CssClass="grid-header-style" />
                                                <ItemStyle Width ="50px" CssClass="grid-item-style-center" />
                                            </asp:BoundField>
                                            <asp:BoundField HeaderText="<%$ Resources:NameResource, resBelongingCode %>" DataField="GroupCd" ReadOnly="True">
                                                <HeaderStyle Width="100px" CssClass="grid-header-style" />
                                                <ItemStyle width="100px" CssClass="grid-item-style-center" />
                                            </asp:BoundField>
                                            <asp:BoundField HeaderText="<%$ Resources:NameResource, resBelongingName %>" DataField="GroupNm" ReadOnly="True">
                                                <HeaderStyle Width="150px" CssClass="grid-header-style" />
                                                <ItemStyle Width ="150px" CssClass="grid-item-style-center" />
                                            </asp:BoundField>
                                            <asp:BoundField HeaderText="<%$ Resources:NameResource, resStartDate %>" DataField="StartDate" ReadOnly="True" >
                                                <HeaderStyle Width="100px" CssClass="grid-header-style" />
                                                <ItemStyle Width ="100px" CssClass="grid-item-style-center" />
                                            </asp:BoundField>
                                        </Columns>
                                        <RowStyle BackColor="#EFF3FB" />
                                        <EditRowStyle BackColor="#2461BF" />
                                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Wrap="False" />
                                        <AlternatingRowStyle BackColor="White" />
                             </asp:GridView>
                          </div>
                          <div id="ScrollableGridViewDataDiv" style="width:400px; float:left; height:150px; overflow-x:hidden; overflow-y:auto;" onscroll="ScrollableGridViewHeaderDiv.scrollLeft=this.scrollLeft;document.getElementById('ctl00_hdnScrollPosX').value = this.scrollLeft;document.getElementById('ctl00_hdnScrollPosY').value = this.scrollTop;">
                            <asp:GridView ID="grvGroup" runat="server" ForeColor="#333333" Font-Size="10pt" 
                                 AutoGenerateColumns="False" ShowHeader ="false" >
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <Columns>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                   <asp:CheckBox ID="chkGroup" runat="server" TabIndex ="5" />
                                                </ItemTemplate>
                                                <HeaderStyle Width="50px" CssClass="grid-header-style" />
                                                <ItemStyle Width="50px" CssClass="grid-item-style-center" />
                                            </asp:TemplateField>
                                            <asp:BoundField HeaderText="<%$ Resources:NameResource, resBelongingCode %>" DataField="GroupCd" ReadOnly="True">
                                                <HeaderStyle Width="100px" CssClass="grid-header-style" />
                                                <ItemStyle Width="100px" CssClass="grid-item-style-center" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="SubNo" >
                                                <HeaderStyle CssClass="hidden" />
                                                <ItemStyle CssClass="hidden" />
                                            </asp:BoundField>
                                            <asp:BoundField HeaderText="<%$ Resources:NameResource, resBelongingName %>" DataField="GroupNmAbbreviation" ReadOnly="True">
                                                <HeaderStyle Width="150px" CssClass="grid-header-style" />
                                                <ItemStyle Width="150px" CssClass="grid-item-style-center" />
                                            </asp:BoundField>
                                            <asp:BoundField HeaderText="<%$ Resources:NameResource, resStartDate %>" DataField="StartDate" ReadOnly="True" DataFormatString="{0: yyyy/MM/dd}">
                                                <HeaderStyle Width="100px" CssClass="grid-header-style" />
                                                <ItemStyle Width="100px" CssClass="grid-item-style-center" />
                                            </asp:BoundField>
                                        </Columns>
                                        <RowStyle BackColor="#EFF3FB" />
                                        <EditRowStyle BackColor="#2461BF" />
                                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Wrap="False" />
                                        <AlternatingRowStyle BackColor="White" />
                                    </asp:GridView>
                         </div>
                       </div>  
                    <div style="margin-top:0px; float:left;width : 30px; ">
                    </div>
                </ContentTemplate>
              </asp:UpdatePanel>
           </div>
            
           <div style="margin-top:5px; float:right; height: 35px; width : 450px; "> 
                   <div style="margin-top:0px; float:left;width : 350px; ">
                   </div>
                   <asp:Button ID="btnThrow" runat="server" Text="確定" TabIndex="6" /> 
            </div>

 </asp:Content> --------------------编程问答-------------------- .aspx.vb
Option Strict On
Imports Mugen.Rk21Web.Common.Dao
Imports Mugen.Rk21Web.Common.UserInfo
Imports Mugen.Rk21Web.Common.Const
Imports Mugen.Rk21Web.Common.Helper


Partial Class CCMN03D001
    Inherits System.Web.UI.Page

#Region ""
    Private Const STAFFGROUPSELECT As String = "StaffGroupSelect" 
    Private Const STARTDATEFORGROUP As String = "StartDateForGroup"     
    Private Const SUBNO As String = "SubNo"
#End Region

#Region ""

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        LogHelper.Instance.beginMethod()
        CreateGridViewHeader()

        Response.Buffer = True
        Response.ExpiresAbsolute = Now()   '-1  
        Response.Expires = 0
        Response.CacheControl = "no-cache"

        If Not IsPostBack Then
            Me.InitControl()
        End If

        HttpContext.Current.Session(STAFFGROUPSELECT) = Nothing
        Me.btnThrow.OnClientClick = "javascript:window.close();"
        LogHelper.Instance.EndMethod()
    End Sub

    Protected Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Error
        LogHelper.Instance.Error(Request.Url.ToString() & ":" & Server.GetLastError().GetBaseException().Message.ToString())
        Server.ClearError()
        Response.Redirect(RkConst.ERRORPG)
    End Sub

    Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        LogHelper.Instance.BeginMethod()
        Dim strCorpCd As String = ViewState("CorpCd").ToString
        Dim dataTable As Data.DataTable
        Dim arrArrayList As New ArrayList
        Dim dbCommon As New DbCommon
        Dim mstGroupDao As New MstGroupDao(dbCommon)
        dbCommon.Open()

        If txtGroupCd.Text = "" Then
            dataTable = mstGroupDao.GetGroupRecord(txtGroupNm.Text, Integer.Parse(ViewState(SUBNO).ToString), strCorpCd)
        Else
            dataTable = mstGroupDao.GetGroupRecord(txtGroupCd.Text, Integer.Parse(ViewState(SUBNO).ToString), strCorpCd)
        End If

        If mstGroupDao.IsError Then
            Master.AddErrorMessage(mstGroupDao.GetError)
            LogHelper.Instance.EndMethod()
            Exit Sub
        Else
            grvGroup.DataSource = dataTable
            grvGroup.DataBind()
        End If
        dbCommon.Close()

        uplDetil.Update()
        LogHelper.Instance.EndMethod()
    End Sub

    Protected Sub btnThrow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnThrow.Click
        LogHelper.Instance.BeginMethod()
        Dim dataTable As New Data.DataTable
        Dim dataRow As Data.DataRow
        Dim colGroupCd As Data.DataColumn = New Data.DataColumn("GroupCd")
        colGroupCd.DataType = System.Type.GetType("System.String")
        dataTable.Columns.Add(colGroupCd)
        Dim colSubNo As Data.DataColumn = New Data.DataColumn("SubNo")
        colSubNo.DataType = System.Type.GetType("System.String")
        dataTable.Columns.Add(colSubNo)
        Dim colGroupNm As Data.DataColumn = New Data.DataColumn("GroupNmAbbreviation")
        colGroupNm.DataType = System.Type.GetType("System.String")
        dataTable.Columns.Add(colGroupNm)
        Dim colStartDate As Data.DataColumn = New Data.DataColumn("StartDate")
        colStartDate.DataType = System.Type.GetType("System.String")
        dataTable.Columns.Add(colStartDate)


        For i As Integer = 0 To grvGroup.Rows.Count - 1
            If CType(grvGroup.Rows(i).Cells(0).FindControl("chkGroup"), CheckBox).Checked = True Then
                dataRow = dataTable.NewRow
                dataRow("GroupCd") = grvGroup.Rows(i).Cells(1).Text
                dataRow("SubNo") = grvGroup.Rows(i).Cells(2).Text
                dataRow("GroupNmAbbreviation") = grvGroup.Rows(i).Cells(3).Text
                dataRow("StartDate") = grvGroup.Rows(i).Cells(4).Text
                dataTable.Rows.Add(dataRow)
            End If
        Next

        HttpContext.Current.Session(STAFFGROUPSELECT) = dataTable
        LogHelper.Instance.EndMethod()
    End Sub

    Protected Sub txtGroupCd_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtGroupCd.TextChanged
        LogHelper.Instance.BeginMethod()
        txtGroupNm.Text = ""
        LogHelper.Instance.EndMethod()
    End Sub

    Protected Sub txtGroupNm_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtGroupNm.TextChanged
        LogHelper.Instance.BeginMethod()
        txtGroupCd.Text = ""
        LogHelper.Instance.EndMethod()
    End Sub


#End Region

#Region ""

    Private Sub InitControl()
        LogHelper.Instance.BeginMethod()

        Dim strCorpCd As String = vbNullString
        Dim userInfo As UserInfo = CType(HttpContext.Current.Session(RkConst.LoginInfo), UserInfo)
        If userInfo IsNot Nothing Then
            ViewState("CorpCd") = userInfo.CorpCd
            strCorpCd = ViewState("CorpCd").ToString
        End If

        Dim dataTable As Data.DataTable
        Dim dbCommon As New DbCommon
        Dim mstGroupDao As New MstGroupDao(dbCommon)
        dbCommon.Open()

     
        If Session(STARTDATEFORGROUP) IsNot Nothing Then
            dataTable = mstGroupDao.GetGroupForStaff(strCorpCd, Date.Parse(Session(STARTDATEFORGROUP).ToString))
        Else
            dataTable = mstGroupDao.GetGroupForStaff(strCorpCd, Date.Now)
        End If

        If dataTable.Rows.Count = 0 Then
            ViewState(SUBNO) = -1
        Else
            ViewState(SUBNO) = dataTable.Rows(0).Item(SUBNO).ToString
        End If

        If mstGroupDao.IsError Then
            dbCommon.Rollback()
            dbCommon.Close()
            LogHelper.Instance.EndMethod()
            Exit Sub
        Else
            grvGroup.DataSource = dataTable
            grvGroup.DataBind()
        End If
        dbCommon.Close()
        LogHelper.Instance.EndMethod()
    End Sub


    Private Sub CreateGridViewHeader()
        LogHelper.Instance.BeginMethod()
    
        Dim dataTable As New Data.DataTable

        dataTable.Columns.Add("Select")
        dataTable.Columns.Add("GroupCd")
        dataTable.Columns.Add("GroupNm")
        dataTable.Columns.Add("StartDate")

        dataTable.NewRow()
        dataTable.Rows().Add()

        grvHead.DataSource = dataTable
        grvHead.DataBind()
        grvHead.Rows(0).Visible = False
        LogHelper.Instance.EndMethod()
    End Sub

#End Region

End Class


补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,