Solved

vb Code Behind Ajax  Modalpopup Extender button not firing

Posted on 2013-11-19
4
1,093 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now