Click here to Skip to main content
15,891,375 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Physical OPSWAT Metascan is a COM component and service. Will there be a .NET version in the near future or will this be the current COM version? Pin
Paul Conrad2-Sep-08 19:13
professionalPaul Conrad2-Sep-08 19:13 
Questionasp.net configuration Pin
pinkidasu2-Sep-08 8:31
pinkidasu2-Sep-08 8:31 
AnswerRe: asp.net configuration Pin
Bassam Saoud2-Sep-08 10:26
Bassam Saoud2-Sep-08 10:26 
QuestionChecking the source of method call Pin
geekfromindia2-Sep-08 8:29
geekfromindia2-Sep-08 8:29 
AnswerRe: Checking the source of method call Pin
Bassam Saoud2-Sep-08 10:29
Bassam Saoud2-Sep-08 10:29 
QuestionHow long is the support life cycle for a specific version/release of the Metascan product? Pin
TennisGod2-Sep-08 8:21
TennisGod2-Sep-08 8:21 
AnswerRe: How long is the support life cycle for a specific version/release of the Metascan product? Pin
DelbertWormklein2-Sep-08 8:24
DelbertWormklein2-Sep-08 8:24 
QuestionModalPopup / Update Panel / Button Click Event Not Firing [modified] Pin
SQUeeK842-Sep-08 8:20
SQUeeK842-Sep-08 8:20 
I’m having and issue firing code behind on one of my asp buttons.

Screen Shot 1 - http://beta.sdsna.com/ModalFiles/ss1.jpg - Prior to clicking the update button
Screen Shot 2 - http://beta.sdsna.com/ModalFiles/ss2.jpg - Box after clicking the update button, no event behind was fired
Project Files - http://beta.sdsna.com/ModalFiles/AJAXModalPopup.zip

Project Overview:
I have one list page (UserList.aspx) that contains a ModalPopupExtender. An ascx control (ModalContainer.ascx) loads within that ModalPopupExtender and retrieves a few parameters set by the list page. Based on one of the parameters, the ModalContainer.ascx control dynamically loads in another ascx control. The control that gets loaded in could be to edit user, add user, etc.

Everything works fine except on the last ascx control that gets loaded in. On that control I have an asp submit button which should fire code behind but does not.

UserList.aspx
UserList.aspx contains an add user button which calls a JavaScript function ShowModalPopup and accepts up to 4 parameters. When this function is called it sets global JavaScript variables of the passed parameters and then opens up the ModalPopupExtender which has the ModalContainer.ascx control inside.

ModalContainer.ascx
When the popup extender is opened the ascx control has a JavaScript function for pageLoad(). The pageLoad() function does $find(“ModalPopupExtender”).add_shown(SetPostBack);.

The SetPostBack() function does the following – gets the global JavaScript variables and inserts the values into hidden text box fields and then fires btnPostBack.click(); which is a hidden button on the form.

I have an update panel with the ContentTemplate having an ASP:Placeholder and the Trigger being btnPostBack with EventName=”Click”.

So when this button is clicked, the code behind reads the values in the hidden text boxes and loads into the ASP:Placeholder the proper ascx control – it being UserEdit.ascx for this example.

UserEdit.ascx
This control contains 3 ASP:Textboxes, UpdatePanel and ASP:RequiredFieldValidators. In the code behind page load event I again read the values in the hidden text boxes and populate the form from the database.

The purpose of the update panel is when the user clicks the update button, I validate that the username is not already taken and if it is I show a message label that is in the ContentTemplate of the update panel.

All of the above works fine except when I click the update button. On clicking of the update button it does not fire the Click event in the code behind. Instead it basically closes itself and what I am left with is a blank modal popup.

The RequiredFieldValidators do work - just the code behind event does not. Removing the validators does not fix the problem either..

Any idea’s or how I should approach this in a different manner to accomplish my goal?

ModalContainer.ascx - CODE   <br />
<br />
<!-- Post Back Javascript Code Start --><br />
    <script language="javascript"><br />
        function pageLoad(){<br />
            //Calls Function when Modal is Popped Up<br />
            $find("ModalContainerPopupBehavior").add_shown(SetPostBack);  //ModalPopupExtenderBehavior IS BehaviorID VALUE            <br />
        }<br />
        <br />
        function SetPostBack(){ <br />
            //Set Post Back and Set JS Values passed from calling form to be accessible from code behind<br />
            var objParam1TextBox = '<%=txtParam1.ClientID %>';<br />
            document.getElementById(objParam1TextBox).value=vParam1;<br />
            <br />
            var objParam2TextBox = '<%=txtParam2.ClientID %>';<br />
            document.getElementById(objParam2TextBox).value=vParam2;<br />
            <br />
            var objParam3TextBox = '<%=txtParam3.ClientID %>';<br />
            document.getElementById(objParam3TextBox).value=vParam3;   <br />
<br />
            var objParam4TextBox = '<%=txtParam4.ClientID %>';<br />
            document.getElementById(objParam4TextBox).value=vParam3;                                            <br />
            <br />
            //Post Form Back - So we can get variables passed from Javascript<br />
            var objControl = '<%=btnPostBack.ClientID %>';<br />
            document.getElementById(objControl).click();                            <br />
        }    <br />
        <br />
    </script><br />
    <!-- Post Back Javascript Code End --><br />
    <br />
    <!-- Hidden Text Boxes to Pass Values from Calling Form --><br />
    <asp:TextBox ID="txtParam1" runat="server" style="display:none;"></asp:TextBox><br />
    <asp:TextBox ID="txtParam2" runat="server" style="display:none;"></asp:TextBox><br />
    <asp:TextBox ID="txtParam3" runat="server" style="display:none;"></asp:TextBox>    <br />
    <asp:TextBox ID="txtParam4" runat="server" style="display:none;"></asp:TextBox>  <br />
    <br />
    <!-- Hidden Postback button used to post back form on load to set Hidden Text Box Values --><br />
    <asp:Button ID="btnPostBack" runat="Server" Text="Post Back" style="display:none;" CausesValidation="false" />            <br />
    <br />
    <asp:UpdatePanel ID="updPostBack" runat="server">     <br />
        <ContentTemplate><br />
            <asp:PlaceHolder ID="phModal" runat="server"></asp:PlaceHolder><br />
        </ContentTemplate><br />
        <Triggers>   <br />
            <asp:AsyncPostBackTrigger ControlID="btnPostBack" EventName="Click" /><br />
        </Triggers><br />
    </asp:UpdatePanel>      <br />
<br />
<br />
<br />
UserEdit.ascx CODE BELOW<br />
<br />
   <table cellpadding="0" cellspacing="4" border="0"><br />
        <tr><br />
            <td colspan="2">User Edit</td><br />
        </tr>     <br />
        <tr><br />
            <td>First:</td><br />
            <td><asp:TextBox ID="txtFirstName" runat="server" CssClass="input" MaxLength="50"></asp:TextBox></td><br />
        </tr><br />
        <tr><br />
            <td>Last:</td><br />
            <td><asp:TextBox ID="txtLastName" runat="Server" CssClass="input" MaxLength="50"></asp:TextBox></td><br />
        </tr><br />
        <tr><br />
            <td>User:</td><br />
            <td><asp:TextBox ID="txtUserName" runat="server" CssClass="input" MaxLength="50"></asp:TextBox></td><br />
        </tr><br />
        <tr><br />
            <td colspan="2" align="right">                <br />
                <input type="button" value="Cancel" onclick="CloseModalPopup('ModalContainerPopupBehavior');" /><asp:Button ID="btnUpdateUser" runat="server" Text="Update User" CssClass="formButton" />  <br />
            </td><br />
        </tr>         <br />
    </table>  <br />
    <br />
    <asp:UpdatePanel ID="updSubmit" runat="server"><br />
        <ContentTemplate>              <br />
            <asp:Label ID="lblMessage" runat="Server"></asp:Label><br />
        </ContentTemplate><br />
        <Triggers><br />
            <asp:AsyncPostBackTrigger ControlID="btnUpdateUser" EventName="Click" />           <br />
        </Triggers>        <br />
    </asp:UpdatePanel>         <br />
            <br />
    <!-- Validation Controls --><br />
    <asp:RequiredFieldValidator runat="server" ID="vFirstName" ControlToValidate="txtFirstName" SetFocusOnError="true" Display="None" ErrorMessage="<b>Required Field Missing</b><br />First name is required." /><br />
    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="veFirstName" TargetControlID="vFirstName" />      <br />
    <br />
    <asp:RequiredFieldValidator runat="server" ID="vLastName" ControlToValidate="txtLastName" SetFocusOnError="true" Display="None" ErrorMessage="<b>Required Field Missing</b><br />Last name is required." /><br />
    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="veLastName" TargetControlID="vLastName" />      <br />
    <br />
    <asp:RequiredFieldValidator runat="server" ID="vUserName" ControlToValidate="txtUserName" SetFocusOnError="true" Display="None" ErrorMessage="<b>Required Field Missing</b><br />User name is required." /><br />
    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="veUserName" TargetControlID="vUserName" /> 


modified on Tuesday, September 2, 2008 6:54 PM

QuestionPublished ASP.Net Application stops IIS when calling FORTRAN dll Pin
Manoj Shukla2-Sep-08 3:53
Manoj Shukla2-Sep-08 3:53 
Questionasp.net configuration Pin
pinkidasu2-Sep-08 3:07
pinkidasu2-Sep-08 3:07 
AnswerRe: asp.net configuration Pin
Abhijit Jana2-Sep-08 3:14
professionalAbhijit Jana2-Sep-08 3:14 
AnswerRe: asp.net configuration Pin
Bassam Saoud2-Sep-08 4:36
Bassam Saoud2-Sep-08 4:36 
QuestionCan't send attachment using MailAttachment Pin
HatakeKaKaShi2-Sep-08 2:41
HatakeKaKaShi2-Sep-08 2:41 
AnswerRe: Can't send attachment using MailAttachment Pin
Manas Bhardwaj2-Sep-08 3:33
professionalManas Bhardwaj2-Sep-08 3:33 
GeneralRe: Can't send attachment using MailAttachment Pin
HatakeKaKaShi2-Sep-08 6:21
HatakeKaKaShi2-Sep-08 6:21 
Questionftp error message Pin
omlac2-Sep-08 2:15
omlac2-Sep-08 2:15 
Questionhow to display small images in datagrid? Pin
muppala1232-Sep-08 1:48
muppala1232-Sep-08 1:48 
AnswerRe: how to display small images in datagrid? Pin
Bardy852-Sep-08 1:55
Bardy852-Sep-08 1:55 
AnswerRe: how to display small images in datagrid? Pin
Manas Bhardwaj2-Sep-08 1:56
professionalManas Bhardwaj2-Sep-08 1:56 
Questionhow to encrypt the query string when hyperlink column is clicked in datagrid? Pin
muppala1232-Sep-08 1:44
muppala1232-Sep-08 1:44 
AnswerRe: how to encrypt the query string when hyperlink column is clicked in datagrid? Pin
Dave Sexton2-Sep-08 3:01
Dave Sexton2-Sep-08 3:01 
Questiongridview help required Pin
pankaj_che2-Sep-08 1:37
pankaj_che2-Sep-08 1:37 
AnswerRe: gridview help required Pin
Palli Rummi2-Sep-08 1:49
Palli Rummi2-Sep-08 1:49 
QuestionRe: gridview help required Pin
pankaj_che4-Sep-08 19:24
pankaj_che4-Sep-08 19:24 
QuestionBin folder is not created in asp.net web application Pin
Milind Panchal2-Sep-08 1:12
Milind Panchal2-Sep-08 1:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.