Modalpopupextender不起作用

时间:2012-04-07 20:14:42

标签: asp.net-ajax

我正在尝试开发每次单击图像时打开弹出窗口的页面。 当我单击此图像时,会出现一个弹出菜单,其中gridview根据页面中的某些文本框填充数据。问题在于,当我第一次写页面时它起作用但是事实并非如此。

背后的代码是

ImageButton lb = sender as ImageButton;
    string shipto = ddlShipto.SelectedValue.ToString();
    TMWWS.BusinessLogic.ProfileII objPlants = new                 TMWWS.BusinessLogic.ProfileII(shipto);
    DataTable dt = objPlants.getPlantsPerShipto();
    gvPlant.DataSource = dt;
    gvPlant.DataBind();
    this.upPlant.Update();
    //pnlPlant.Visible = true;
    pnlPlant_ModalPopupExtender.Show();



  <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

    <legend>Order Header</legend>
    <span class="failureNotification" style="color:green">
       <asp:Literal ID="lblMessage" runat="server"></asp:Literal>
    </span>

    <p>
        <asp:Label ID="TransactionLabel" runat="server" 
            AssociatedControlID="txtTransaction" Height="22px" Width="248px">Transaction Number</asp:Label>
        <asp:TextBox ID="txtTransaction" runat="server" CssClass="textEntry" 
            Enabled="False"></asp:TextBox>
    </p>

    <p>
        <asp:Label ID="ShipToLabel" runat="server" 
            AssociatedControlID="txtTransaction" Height="22px" Width="248px">ShipTo</asp:Label>
        <asp:DropDownList ID="ddlShipto" runat="server" CssClass="textEntry" 
            ></asp:DropDownList>
    </p>

    <p>
        <asp:Label ID="FeedCodeLabel" runat="server" AssociatedControlID="txtFeedCode" 
            Height="21px" Width="320px">Feed Code</asp:Label>
        <asp:TextBox ID="txtFeedCode" runat="server" CssClass="textEntry">888</asp:TextBox>
        <asp:RequiredFieldValidator ID="FeedCodeRequired" runat="server" ControlToValidate="txtFeedCode" 
                CssClass="failureNotification" ErrorMessage="Feed Code is required." ToolTip="Feed Code is required." 
                ValidationGroup="OrderValidationGroup">*</asp:RequiredFieldValidator>
    </p>

    <p>
        <asp:Label ID="PlantLabel" runat="server" AssociatedControlID="txtPlant" 
            Height="21px" Width="320px">Plant</asp:Label>

        <asp:TextBox ID="txtPlant" runat="server"></asp:TextBox>
        <asp:ImageButton ID="ImgBtnPlant" runat="server" 
                onclick="ImageButton1_Click" ImageUrl="~/Icons/Plant.png" />
     </p>

    <asp:UpdatePanel ID="upPlant" runat="server" UpdateMode="Conditional">
     <ContentTemplate>
      <asp:Panel runat="server" Visible="false" BorderColor="Black" ID="pnlPlant">
        <asp:Button ID="BtnShowDialog" Style="display:none" runat="server" Width="120" Text="Filter" />
        <asp:Label ID="LblPopupHeader" runat="server" Text="Plant-Filter"></asp:Label>
        <asp:GridView ID="gvPlant" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="Plant" onrowcommand="gvPlant_RowCommand">
            <Columns>
                <asp:BoundField DataField="Plant" HeaderText="Plant" SortExpression="Plant" />
                <asp:BoundField DataField="PlantName" HeaderText="PlantName" 
                    SortExpression="PlantName" />
                <asp:ButtonField Text="Button" />
            </Columns>
        </asp:GridView>
      </asp:Panel>
         <ajaxToolkit:ModalPopupExtender ID="pnlPlant_ModalPopupExtender" runat="server" 
             DynamicServicePath="" Enabled="True" TargetControlID="pnlPlant" PopupControlID="BtnShowDialog">
         </ajaxToolkit:ModalPopupExtender>
     </ContentTemplate>
    </asp:UpdatePanel>   

2 个答案:

答案 0 :(得分:0)

您可以尝试使用Popup扩展器。这是一个棘手的问题,我遇到了同样的问题,我正在尝试使用弹出扩展器。这是一些代码段。

<asp:LinkButton ID="LnkOrder" runat="server" BehaviorID="pop" CssClass="PopupMenu" CommandName="LnkOrder">Order</asp:LinkButton>
                     <asp:PopupControlExtender ID="LnkOrder_PopupControlExtender" 
                   runat="server" DynamicServicePath="" Enabled="True" ExtenderControlID="" 
                   PopupControlID="PopupMove" TargetControlID="LnkOrder">
               </asp:PopupControlExtender>

此外,我需要隐藏弹出窗口尝试使用此JavaScript。不要忘记更改BehaviorID。这是javascript

$find('pop').hide();

答案 1 :(得分:0)

此外,您可以从Ajax工具包下载最新版本。我已经下载了它,并在我的VS中添加了工具箱。现在它正常工作的是下载链接:

Latest ajax toolkit version