Solved

vb Code Behind Ajax  Modalpopup Extender button not firing

Posted on 2013-11-19
4
1,203 Views
Last Modified: 2014-01-03
I have a basic page that has 3 radio buttons and a submit. When the submit is clicked, I need the code behind to fire and then mpe.show.

When setting the TargetControlID="Button1", the modalpopup works fine, but the code is not triggered.
When the TargetControlID="Button_Fk" then the code behind works, but the modalpopup does not execute:
Here is the following codes:

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication1.WebForm1" EnableEventValidation="False" SmartNavigation="False"%>
<%@ Register assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
   
    <h1>
         Warehouse Equipment</h1>
         

    <asp:UpdatePanel ID="mainContentUpdatePanel" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        Reporting<br />
        <br />
        Select a report-<br />
        <asp:RadioButtonList ID="RadioButtonList1" runat="server" BorderColor="Gray"
            BorderWidth="1px" Width="368px">
            <asp:ListItem Value="1" Selected="True">Master Inventory List</asp:ListItem>
            <asp:ListItem Value="2">Master Inventory and Last Scanned Location</asp:ListItem>
              </asp:RadioButtonList>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Generate Report" CommandArgument = "Button1_Click" />
 
        <asp:Button ID="Button_fk" runat="server" Text="Button" Visible="False" />
           <br />

    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"
             CombineScripts="true">
         </ajaxToolkit:ToolkitScriptManager>
     

    <ajaxToolkit:ModalPopupExtender ID="mpe" runat="server" BehaviorID="mpe" TargetControlID="Button_fk"
                PopupControlID="Panel1" BackgroundCssClass="modalBackground" DropShadow="True" >
   
        </ajaxToolkit:ModalPopupExtender>

       
   <asp:Panel ID="Panel1" runat="server" Width="600px" BackColor="white" CssClass="modalpopup"
                ForeColor="Black" Height="400px" Style="text-align: left" BorderColor="Black">
     
   
         <asp:Button ID="Button2" runat="server" Text="Close Window" />
         <br />
   
    <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
            AutoDataBind="true" HasToggleGroupTreeButton="False"
            ToolPanelView="None" />
   
         <br />
   
   
    </asp:Panel>
   
  </ContentTemplate>
  </asp:UpdatePanel>
</asp:Content>


CODE BEHIND-------------------------------------------

 Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click

        mpe.Show()
' EXECUTE SOME CODE TO RUN REPORTS

End sub
0
Comment
Question by:BKennedy2008
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 39659741
This line :

<asp:Button ID="Button1" runat="server" Text="Generate Report" CommandArgument = "Button1_Click" />

should be :

<asp:Button ID="Button1" runat="server" Text="Generate Report" OnClick = "Button1_Click" />
0
 

Author Comment

by:BKennedy2008
ID: 39659914
I changed it to that, but that was even a last-minute test adding that line to the button. (either commands do not perform a click function)

When you open the page, the Panel1 is viewed on the page when it is set to the fake button, and when it is set the button1, it is not displayed, even when I have a mpe.hide on page load.
0
 
LVL 11

Accepted Solution

by:
SAMIR BHOGAYTA earned 500 total points
ID: 39665068
hi.. this is your solution

Aspx

<ajax:ModalPopupExtender runat="server" ID="modalPop"
            PopupControlID="pnlpopup"
            TargetControlID="btnGo"
              BackgroundCssClass="modalBackground"
             DropShadow="true"
             CancelControlID="btnCancel" X="470" Y="300"   />


//Codebehind    
protected void OkButton_Clicked(object sender, EventArgs e)
    {

        modalPop.Hide();
        //Do something in codebehind
    }

And don't set the OK button as OkControlID.
0
 

Author Comment

by:BKennedy2008
ID: 39674396
I am not sure I see any diffenrence between your code and mine. I am using a fake button for
the target controlID as you are using a button labled  btnGo?
I do not have an OKControlID.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question