Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ModalPopupXtender Show()未启动_C#_Asp.net_Visual Studio 2012_Ajaxcontroltoolkit_Modalpopupextender - Fatal编程技术网

C# ModalPopupXtender Show()未启动

C# ModalPopupXtender Show()未启动,c#,asp.net,visual-studio-2012,ajaxcontroltoolkit,modalpopupextender,C#,Asp.net,Visual Studio 2012,Ajaxcontroltoolkit,Modalpopupextender,我知道这个问题已经在互联网上被问过很多次了。然而,即使在阅读并尝试了所有这些解决方案之后,我仍然无法找到正确的解决方案。我希望有人能帮我解决这个问题。 我的代码基于。 我有一个GridView,它的数据来源于SqlDataSource1。在该GridView中,在第一列中我有视图按钮,这些按钮应该显示ModalPopupExtender1中每一行的详细信息。我将其TargetControlID设置为btnShowPopup,它不可见,但正如我所说的“不可见”并不意味着它设置为可见=“false”

我知道这个问题已经在互联网上被问过很多次了。然而,即使在阅读并尝试了所有这些解决方案之后,我仍然无法找到正确的解决方案。我希望有人能帮我解决这个问题。

我的代码基于。

我有一个GridView,它的数据来源于SqlDataSource1。在该GridView中,在第一列中我有视图按钮,这些按钮应该显示ModalPopupExtender1中每一行的详细信息。我将其TargetControlID设置为btnShowPopup,它不可见,但正如我所说的“不可见”并不意味着它设置为可见=“false”,而是设置为style=“display:none”(我发现人们就是这样做的)。

问题是,即使我单击其中一个视图按钮,ModalPopup也不会出现。事实上,当我单击按钮时,什么也没有发生。

在Visual Basic上,单击“查看”按钮后,我看不到任何错误消息或异常处理程序。

在过去的几天里,这个问题一直困扰着我

任何帮助都将不胜感激。提前谢谢你



这是我的代码。
aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Main/MasterPage.master" AutoEventWireup="true" CodeFile="SearchAcquisition.aspx.cs" Inherits="PosStock" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Maincontent" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
    <div class="contentboxh">
    <h2 class="hpos">Acquisition Search</h2>
        <br />
        <br />
        <h2 class="h4" style="text-align: left">Search</h2>
        <br />

        <asp:TextBox ID="SearchField" runat="server" Width="350px" Height="30px" OnTextChanged="SearchField_TextChanged"></asp:TextBox>
        <asp:Button ID="SearchButton" runat="server" Text="Search" Height="26px" OnClick="SearchButton_Click" BackColor="#7AB800" CssClass="searchbutton" />

    </div>
    <div class="contentboxh">

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="SELECT [acquisition_ID], [acquisition_name], [acquisition_qty], [acquisition_cost], [acquisition_date], [acquisition_status] FROM [Acquisition] WHERE [acquisition_ID] = @acquisition_ID"
            SelectCommandType="Text" CancelSelectOnNullParameter="true" ConnectionString="<%$ ConnectionStrings:MJENTAConnectionString %>"></asp:SqlDataSource>

        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:GridView ID="GridView1" runat="server" DataKeyNames="acquisition_ID" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" PageSize="10" Width="95%">
                    <Columns>
                        <asp:TemplateField ControlStyle-Width="50px" HeaderStyle-Width="60px">
                            <ItemTemplate>
                                <asp:Button ID="btnViewDetails" runat="server" Text="Details" CommandName="View" OnClick="BtnViewDetails_Click" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="acquisition_ID" HeaderText="ID" SortExpression="acquisition_ID" ReadOnly="true" />
                        <asp:BoundField DataField="acquisition_name" HeaderText="Name" SortExpression="acquisition_name" ReadOnly="true" />
                        <asp:BoundField DataField="acquisition_qty" HeaderText="Quantity" SortExpression="acquisition_qty" ReadOnly="true" />
                        <asp:BoundField DataField="acquisition_cost" HeaderText="Cost" SortExpression="acquisition_cost" ReadOnly="true" />
                        <asp:BoundField DataField="acquisition_date" HeaderText="Date Added" SortExpression="acquisition_date" ReadOnly="true" />
                        <asp:BoundField DataField="acquisition_status" HeaderText="Status" SortExpression="acquisition_status" ReadOnly="true" />
                    </Columns>
                </asp:GridView>
            </ContentTemplate>
        </asp:UpdatePanel>


        <asp:Button ID="btnShowPopup" runat="server" style="display:none" />
        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnShowPopup" PopupControlID="pnlPopup"
                        CancelControlID="btnClose" BackgroundCssClass="modalBackground" />

        <asp:Panel ID="pnlPopup" runat="server" CssClass="detail" Width="500px" style="display:none">
            <asp:UpdatePanel ID="updPnlCustomerDetail" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:Label ID="lblCustomerDetail" runat="server" Text="Detail" BackColor="LightBlue" Width="95%" />
                    <asp:DetailsView ID="DetailsView1" runat="server" DefaultMode="Edit" Width="95%" BackColor="White" />
                </ContentTemplate>
            </asp:UpdatePanel>
            <div align="right" style="width:95%">
                <asp:Button ID="btnSave" runat="server" Text="Save" Width="50px" />
                <asp:Button ID="btnClose" runat="server" Text="Close" Width="50px" />
            </div>
        </asp:Panel>
    </div>
</asp:Content>
public partial class PosStock : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void BtnViewDetails_Click(object sender, EventArgs e)
    {
        Button btnDetails = sender as Button;
        GridViewRow row = (GridViewRow)btnDetails.NamingContainer;

        this.SqlDataSource1.SelectParameters.Clear();
        this.SqlDataSource1.SelectParameters.Add("acquisition_ID", Convert.ToString(this.GridView1.DataKeys[row.RowIndex].Value));
        this.DetailsView1.DataSource = this.SqlDataSource1;
        this.DetailsView1.DataBind();

        this.updPnlCustomerDetail.Update();
        ModalPopupExtender1.Show();

    }
    protected void SearchField_TextChanged(object sender, EventArgs e)
    {

    }
    protected void SearchButton_Click(object sender, EventArgs e)
    {
        SqlConnection con = new     SqlConnection(ConfigurationManager.ConnectionStrings["MJENTAConnectionString"].ToString());

        SqlCommand cmd;

        String str = "SELECT acquisition_ID, acquisition_name, acquisition_qty, acquisition_cost, acquisition_date, acquisition_status FROM Acquisition WHERE (acquisition_name like '%' + @search + '%')";
        cmd = new SqlCommand(str, con);
        cmd.Parameters.Add("@search", SqlDbType.NVarChar).Value = SearchField.Text;
        con.Open();
        cmd.ExecuteNonQuery();
        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = cmd;
        DataSet ds = new DataSet();
        da.Fill(ds, "acquisition_name");
        GridView1.DataSource = ds;
        GridView1.DataBind();
        con.Close();
    }
}