Solved

vb Code Behind Ajax  Modalpopup Extender button not firing

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

864 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

22 Experts available now in Live!

Get 1:1 Help Now