Solved

vb Code Behind Ajax  Modalpopup Extender button not firing

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 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