Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

ModalPopupExtender Not Popping Up - Loads in table

$
0
0

I have a page when I click a certain set of sequences (Delete then OK to Delete then Add New) the modalPopupExtender displays inside of a table.  It supposed to be in a lightbox type display.  All other times it pops up correctly.

Here's the front page .aspx

<%@ Page  validateRequest="false" Title="Department Meeting Notes" Language="VB" MasterPageFile="~/Masters/mstrIntranet.master" AutoEventWireup="false" CodeFile="Select.aspx.vb" Inherits="Tools_MeetingNotes" MaintainScrollPositionOnPostBack="True"%>

<asp:Content ID="Content1" ContentPlaceHolderID="contentplaceholder2" Runat="Server">

<style type="text/css"">

                .modalBackgroundClass {

                background-color:White;

                filter:alpha(opacity=70);

                opacity:0.7; }

</style>

<script type="text/javascript" src="../../includes/tinymce/tinymce.min.js"></script>

<script type="text/javascript">

                tinymce.init({

                selector: "textarea#elm1",

                theme: "modern",

                height: 200,

                plugins: [

                "advlist autolink link image lists charmap print preview hr anchor pagebreak ",

                "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime nonbreaking",

                "save table contextmenu directionality  template paste textcolor iespell"    ],

                content_css: "css/content.css",

                menubar: "edit insert table format",

                toolbar: "table | undo redo | bold italic underline subscript superscript | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | forecolor backcolor | iespell | ",

                style_formats: [

                { title: 'Bold text', inline: 'b' },

                { title: 'Title', inline: 'b', size: '6' },

                { title: 'Red text', inline: 'span', styles: { color: '#ff0000'} },

                { title: 'Red header', block: 'h1', styles: { color: '#ff0000'} }                              ]

                });

</script>

<script language="JavaScript" type="text/javascript">

                function transferData() {

                document.getElementById('ctl00_contentplaceholder2_MeetingInfoRvw').innerHTML = document.getElementById('ctl00$contentplaceholder2$elm1').value;    }

</script>

<table cellpadding="0" cellspacing="0" style="width: 720px; height: 446px;">

<tr>

<td height="449" valign="top">

<form id="Form1" name="form1" method="post" runat="server">

<asp:ScriptManager ID="scriptmanager1" runat="server"></asp:ScriptManager>

<table cellpadding="0" cellspacing="0" class="text" border="0" style="width: 720px;">

<tr valign="top">

<td style="width: 149px" class="textBold" >Year:</td>

<td style="width: 571px" colspan="3" >

<asp:DropDownList ID="YearDD" runat="server" autopostback="true">

                <asp:ListItem>2013</asp:ListItem>

                <asp:ListItem>2012</asp:ListItem>

</asp:DropDownList></td>

</tr>

<tr valign="top">

<td style="width: 149px" class="textBold" >Month: </td>

<td style="width: 412px">

<asp:DropDownList ID="MonthDD" runat="server" AutoPostBack="True">

                <asp:ListItem Text="January" Value="1" ></asp:ListItem>

                <asp:ListItem Text="February" Value="2"></asp:ListItem>

                <asp:ListItem Text="March" Value="3"></asp:ListItem>

                <asp:ListItem Text="April" Value="4"></asp:ListItem>

                <asp:ListItem Text="May" Value="5"></asp:ListItem>

                <asp:ListItem Text="June" Value="6"></asp:ListItem>

                <asp:ListItem Text="July" Value="7"></asp:ListItem>

                <asp:ListItem Text="August" Value="8"></asp:ListItem>

                <asp:ListItem Text="September" Value="9"></asp:ListItem>

                <asp:ListItem Text="October" Value="10"></asp:ListItem>

                <asp:ListItem Text="November" Value="11"></asp:ListItem>

<asp:ListItem Text="December" Value="12"></asp:ListItem>

</asp:DropDownList>

<asp:Label ID="errorLBL" runat="server" Text=""></asp:Label>

</td>

<td style="text-align: right">

<asp:LinkButton ID="AddNewLinkBtn" runat="server" class="textBold" CausesValidation="false" CommandName="AddNewLinkBtn_Click" >Add New</asp:LinkButton>

</td>

<td style="width: 10px;"></td>

</tr>

<tr valign="top">

<td style="height: 8px;" colspan="4" ></td>

</tr>

<tr valign="top">

<td colspan="4" class="textBold" style="height: 16px">

<table cellpadding="3" cellspacing="0" style="border-style: inset; border-width: 1px; width: 730px">

<tr>

<td style="height:5px;"></td>

</tr>

<asp:Repeater ID="Repeater1" runat="server" >

<ItemTemplate>     

<%i = i +1 %>                          

<tr bgcolor = <%=(getRowColor(i)) %>>

<td style="width: 10px">&nbsp;</td>

<td style="width: 400px;" class="text"><%#Eval("thisMonth") %> <%#Eval("thisDay")%>

</td>

<td style="text-align: right"  class="text"><asp:LinkButton ID="EditBtn" runat="server" CommandName="Edit" CommandArgument='<%#Eval("id")%>' OnCommand="Repeater1_ItemCommand"   Text="Edit" CausesValidation="false"></asp:LinkButton>

                </td>

<td style="text-align: right" style="width: 40px">&nbsp;</td>

<td style="text-align: right" style="width: 40px"  class="text">

<asp:LinkButton ID="PreviewBtn" runat="server" CommandName="Preview" CommandArgument='<%#Eval("id")%>' OnCommand="Repeater1_ItemCommand"  Text="Preview" CausesValidation="false"></asp:LinkButton>

</td>

<td style="width: 40px">&nbsp;</td>

<td style="text-align: right" style="width: 40px"  class="text">

<asp:LinkButton ID="DeleteBtn" runat="server" CommandName="Delete" CommandArgument='<%#Eval("id")%>'  OnCommand="Repeater1_ItemCommand"  Text="Delete"   CausesValidation="false" OnClientClick='<%# Eval("curMeeting","return confirm(""Are you sure you want to delete the {0} \n                        Meeting Notes?"")") %>' ></asp:LinkButton>

</td>

<td style="width: 10px">&nbsp;</td>

</tr>

</ItemTemplate>

</asp:Repeater>

 

<tr>

<td style="height:5px;"></td>

</tr>

</table>

</td>

</tr>

 

<tr valign="top">

<td colspan="4">&nbsp;</td>

</tr>

<tr valign="top">

<td colspan="4" class="style28">&nbsp;&nbsp;</td>

</tr>

<tr valign="top">

<td colspan="4">

<%--~~~~~~~~~~~~        Add New Meeting Info  Area  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>

<div id="divPopUPAdd" class="contents"

style="width:900px;height:550px;border:solid1px#dddddd; top:50px; position:relative; left: 50px;" runat="server" align="center">

<div id="Layer2" style="position:absolute; left:685px; top:83px; width:97px; height:17px; z-index:5">

<span class="text"><font color="#990000">*Required field </font></span></div>                        

<ajaxToolkit:ModalPopupExtender ID="mpe1" runat="server"

BehaviorID="mpe1"

TargetControlID="AddNewLinkBtn"

PopupControlID="divPopUPAdd"

BackgroundCssClass="modalBackgroundClass" DropShadow="false">

</ajaxToolkit:ModalPopupExtender>

 

<table cellpadding="0" cellspacing="0" style="width: 900px;" border="2" bgcolor="White"  bordercolor="#000000">

<tr>

<td>

<table cellpadding="0" cellspacing="0" style="width: 843 px;" border="0">

<tr>

<td>&nbsp;</td>

<td colspan="3" align="left"><strong class="title1">

<asp:Label ID="headingLBL" runat="server" Text="Add New Dept Meeting Notes"></asp:Label>

</strong><hr></td>

<td>&nbsp;</td>

</tr>

<tr>

<td>&nbsp;</td>

<td class="style29" align="left">Meeting Date<font color="#990000">*</font>:</td>

<td class="style1" align="left">

           <asp:TextBox ID="MeetingDatetxt" runat="server" style="margin-bottom: 0px" Width="78px" CausesValidation="true"></asp:TextBox>

           <asp:RequiredFieldValidator ID="AddDateVld" runat="server" ErrorMessage="Please enter a date" ControlToValidate="MeetingDatetxt" Display="Dynamic" CssClass="textBold" SetFocusOnError="True"></asp:RequiredFieldValidator>

</td>

<td style="width: 524px;" align="left"><asp:ImageButton ID="CalendarBtn" runat="server"  ImageUrl="~/Tools/Images/Calendar2.gif" CausesValidation="false" />

                      <ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="MeetingDatetxt" PopupButtonID="CalendarBtn" ></ajaxToolkit:CalendarExtender>

           <asp:HiddenField ID="hdnID" runat="server" />

</td>

<td>&nbsp;</td>

</tr>

<tr>

<td>&nbsp;</td>

<td  class="textBold" align="left" colspan="3">Meeting Notes Text<font color="#990000">*</font>:

           <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Enter info about the meeting" Display="Dynamic" ControlToValidate="elm1" SetFocusOnError="True"></asp:RequiredFieldValidator></td>

<td>&nbsp;</td>

</tr>

<tr>

<td> &nbsp;</td>

<td colspan="3" align="left">

 

<asp:TextBox ID="elm1" name="elm1" runat="server" TextMode="MultiLine" ClientIDMode="Static"  Width="766px" Height="200px"></asp:textbox></td>

<td> &nbsp;</td>

</tr>

<tr>

<td>&nbsp;</td>

<td colspan="3">&nbsp;</td>

<td>&nbsp;</td>

</tr>

<tr>

<td>&nbsp;</td>

<td colspan="3" align="right">

<asp:Button ID="PreviewNotesBtn" runat="server" Text="Preview Notes" CausesValidation="False" onClientClick="transferData();" />&nbsp;&nbsp;&nbsp;

<asp:Button ID="btnHide" runat="server" Text="Cancel" OnClick="btnHide_Click" CausesValidation="False" />&nbsp;&nbsp;&nbsp;

<asp:Button ID="SubmitAddBtn" runat="server" Text="Submit"/>

<asp:Button ID="SubmitEditBtn" runat="server" Text="Submit" />

</td>

<td>&nbsp;</td>

</tr>

</table>

</td>

</tr>

</table>

<br/>

</div>

<%--~~~~~~~~~~~~     END   Add New Meeting Info  Area  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>

 

<%'~~~~~~~~~~~~~~~~   REVIEW PANEL     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %>

<ajaxToolkit:ModalPopupExtender ID="mpe2" runat="server"

BehaviorID="mpe2"

TargetControlID="PreviewNotesBtn"

PopupControlID="reviewDiv"

BackgroundCssClass="modalBackgroundClass"

DropShadow="false"

CancelControlID="BackBtn" >

</ajaxToolkit:ModalPopupExtender>

<div id="reviewDiv" align="center" style="border: 1px double #000000; display:none; width:750px; height: 600px; top: 780px; overflow-y:scroll; position: relative; word-wrap: break-word; background-color: #FFFFFF;" runat="server">

<table cellpadding="0" cellspacing="0" style="width: 730px;" border="0" bgcolor="White" align="left">

<tr>

<td style="width: 14px; "> </td>

<td colspan="3" align="left"><asp:Label ID="MeetingDateRvw" runat="server" Text="" Visible="false"></asp:Label></td>

<td  style="width: 10px;"> </td>

</tr>

<tr>

<td> </td>

<td colspan="3" align="left"><asp:Label ID="lbl9" runat="server" Text=""></asp:Label><asp:HiddenField ID="hdnReviewID" runat="server" /></td>

<td> </td>

</tr>

<tr>

<td></td>

<td colspan="3" align="left"><asp:Label ID="MeetingInfoRvw" runat="server" Text=""></asp:Label>

</td>

<td></td>

</tr>

<tr>

<td> </td>

<td colspan="3"><asp:Label ID="lblRvw" runat="server" Text=""></asp:Label></td>

<td></td>

</tr>

<tr>

<td> </td>

<td colspan="3" align="right"><asp:Button ID="BackBtn" runat="server" Text="Back" /></td>

<td> </td>

</tr>

</table>

</div>

<%'~~~~~~~~~~~~~~~~   END REVIEW PANEL     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %>

</td>

</table>

</form>

</td>

</tr>

</table>

</td>

</tr>

</table>

</asp:Content>

*****************************************************************************

 Here's the Code Behind: aspx.vb

*****************************************************************************

Partial Class Tools_MeetingNotes

 Inherits System.Web.UI.Page

 Public i, j As Integer

 Public previewText As String

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

   If Not (Page.IsPostBack) Then

      getNotesList()

       i = 1

       j = 1

    End If

 End Sub

  '~~~~~~~~~~ This is the Add New link on the Main Select Page

 Protected Sub AddNewLinkBtn_Click(sender As Object, e As System.EventArgs) Handles AddNewLinkBtn.Click

     clearFields("a")

     SubmitAddBtn.Visible = True

     SubmitEditBtn.Visible = False

     headingLBL.Text = " Add New Dept Meeting Notes"

 End Sub

  '~~~~~~~~~~     In Panel - Preview Button  PreviewNotesBtn  ~~~~~~~~~~~~~~~~~~

 Protected Sub PreviewNotesBtn_Click(sender As Object, e As System.EventArgs) Handles PreviewNotesBtn.Click

     Dim thisMeeting As String

     lbl9.Text = "here"

     thisMeeting = elm1.Text

     mpe1.Hide()

     mpe2.Show()

     MeetingInfoRvw.Text = thisMeeting

     MeetingInfoRvw.Visible = True

 End Sub

 '~~~~~~~~~~     In Panel - Add New Record Button  SubmitAddBtn  ~~~~~~~~~~~~~~~~~~

 Protected Sub SubmitAddBtn_Click(sender As Object, e As System.EventArgs) Handles SubmitAddBtn.Click

     '~~~~~~~~   CHECK TO SEE IF DATE / RECORD ALREADY IN DATABASE    ~~~~~~~~~~~~

     Dim mDate As Date = DateTime.Parse(MeetingDatetxt.Text, New System.Globalization.CultureInfo("en-US"))

     Dim mText As String = HttpUtility.HtmlEncode(elm1.Text)

     Dim param As SqlParameter() = New SqlParameter(0) {}

     param(0) = New SqlParameter("@sDate", mDate)

     Dim dr As SqlDataReader

     Dim strSQL As String

     strSQL = "Select * FROM DeptHeadMeetingNotes WHERE meetingDate = '" & mDate.ToString("yyyy/MM/dd") & "'"

     Dim i As Integer = 0

     dr = DataReaderClassIntranetSQL.GetDataReaderIntranetSQL(strSQL)

     Do While dr.Read

         i = i + 1

     Loop

     dr.Close()

     If (i > 0) Then

         Response.Write("<script language='javascript'>alert('There is already a record with that Meeting Date.');</script>")

     Else 

  '~~~~~~~~~~~~             OK Continue                      ~~~~~~~~~~~~~~~~~~~~

          Dim updater As String = Request.Cookies("LastName").Value

         Dim con As SqlConnection = ExecNonQuerySQL.addData

          strSQL = "INSERT INTO DeptHeadMeetingNotes (meetingDate, meetingNotes, updatedDate, updatedBy ) VALUES "

         strSQL = strSQL + "( @sDate, @sText, getDate() , @sUpdater )"

          Dim cmd As New SqlCommand(strSQL, con)

          cmd.Parameters.AddWithValue("@sDate", mDate)

         cmd.Parameters.AddWithValue("@sText", mText)

         cmd.Parameters.AddWithValue("@sUpdater", updater)

          con.Open()

         Dim result As Integer = cmd.ExecuteNonQuery()

          MeetingDatetxt.Text = ""

         elm1.Text = ""

         mpe1.Hide()

     End If

     getNotesList()

  End Sub

  '~~~~~~~~~~     In Panel - Submit Edit Button    SubmitEditBtn   ~~~~~~~~~~~~~~~~~~

 Protected Sub SubmitEditBtn_Click(sender As Object, e As System.EventArgs) Handles SubmitEditBtn.Click

      Dim thisID As Integer = hdnID.Value

     Dim mDate As Date = DateTime.Parse(MeetingDatetxt.Text, New System.Globalization.CultureInfo("en-US"))

     Dim mText As String = HttpUtility.HtmlEncode(elm1.Text)

     Dim updater As String = Request.Cookies("LastName").Value

      Dim strSQL As String

     strSQL = "UPDATE DeptHeadMeetingNotes SET meetingDate=@sDate, meetingNotes=@sText, updatedDate=getDate(), updatedBy=@sUpdater WHERE id=@ID;"

      Dim con As SqlConnection = ExecNonQuerySQL.addData

     Using con

       Using cmd As New SqlCommand(strSQL, con)

           cmd.CommandType = CommandType.Text

          cmd.Parameters.AddWithValue("@sDate", mDate)

          cmd.Parameters.AddWithValue("@sText", mText)

          cmd.Parameters.AddWithValue("@sUpdater", updater)

          cmd.Parameters.AddWithValue("@ID", thisID)

      Try

              con.Open()

              cmd.ExecuteNonQuery()

           Catch ex As Exception

              errorLBL.Text = ex.ToString

          Finally

              con.Close()

           End Try

       End Using

     End Using

      clearFields("a")

     mpe1.Hide()

 End Sub

  Protected Sub btnHide_Click(sender As Object, e As System.EventArgs) Handles btnHide.Click

     clearFields("a")

     headingLBL.Text = "Add Dept Head Meeting Notes"

 End Sub

  '~~~~~~~~~~~~~~~        NOTES   LIST   ~~~~~~~~~~~~~~~~~~~~~~~~~

 Protected Sub Repeater1_ItemCommand(sender As Object, e As CommandEventArgs)

  Dim s As String = e.CommandName

 Dim thisIDstr As String = e.CommandArgument

 Dim thisIDInt As Integer = CInt(thisIDstr)

  Dim strSQL As String

 Dim dr As SqlDataReader

  '~~~~~~~~~~~~~~~         DELETE     ~~~~~~~~~~~~~~~~~~~~

  If (e.CommandName.Equals("Delete")) Then

      strSQL = "Delete FROM DeptHeadMeetingNotes WHERE id = " & thisIDInt & ""

     Dim result As Integer = InsertRecord(strSQL)

     If (result > 0) Then

         System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=""JavaScript"">" & vbCrLf)

         System.Web.HttpContext.Current.Response.Write("alert(""Meeting Deleted Successfully! "")" & vbCrLf)

         System.Web.HttpContext.Current.Response.Write("</SCRIPT>")

     End If

     getNotesList()

End If

      '~~~~~~~~~~~~~~~         EDIT     ~~~~~~~~~~~~~~~~~~~~

     If (e.CommandName.Equals("Edit")) Then

          strSQL = "Select * FROM DeptHeadMeetingNotes WHERE id = " & thisIDInt & ""

         dr = DataReaderClassIntranetSQL.GetDataReaderIntranetSQL(strSQL)

          Do While dr.Read

             hdnID.Value = dr("id")

             MeetingDatetxt.Text = (dr("meetingDate"))

             elm1.Text = Server.HtmlDecode(dr("meetingNotes"))

         Loop

          mpe1.Show()

     headingLBL.Text = "Edit Dept Meeting Notes"

         SubmitAddBtn.Visible = False

         SubmitEditBtn.Visible = True

         dr.Close()

      End If

      '~~~~~~~~~~~~~~~~   PREVIEW     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      If (e.CommandName.Equals("Preview")) Then

         strSQL = "Select * FROM DeptHeadMeetingNotes WHERE id = " & thisIDInt & ""

         dr = DataReaderClassIntranetSQL.GetDataReaderIntranetSQL(strSQL)

         Do While dr.Read

             hdnReviewID.Value = dr("id")

             'MeetingDateRvw.Text = (dr("meetingDate"))

             MeetingInfoRvw.Text = Server.HtmlDecode(dr("meetingNotes"))

         Loop

         mpe2.Show()

     End If

  End Sub

  Protected Sub MonthDD_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles MonthDD.SelectedIndexChanged

     getNotesList()

 End Sub

  Public Sub getNotesList()

     errorLBL.Text = ""

     Repeater1.DataSource = Nothing

     Repeater1.DataBind()

      Dim thisDate, thisYear As Integer

     Dim strSQL As String

     Dim dr As SqlDataReader

      thisDate = MonthDD.SelectedValue

     thisYear = YearDD.SelectedValue

      strSQL = "SELECT id,  CONVERT(VARCHAR,meetingDate,107) as curMeeting, Day(meetingDate) as thisDay, DateName(Month,meetingDate) as thisMonth, Year(meetingDate) as thisYear FROM DeptHeadMeetingNotes "

     strSQL = strSQL + "WHERE Month(meetingDate) = '" & thisDate & "'AND Year(meetingDate) = '" & thisYear & "' "

     strSQL = strSQL + "ORDER BY meetingDate "

     dr = DataReaderClassIntranetSQL.GetDataReaderIntranetSQL(strSQL)

     If (dr.HasRows) Then

         Repeater1.DataSource = dr

         Repeater1.DataBind()

     Else

         errorLBL.Text = "<font color=red><b>There are no records found for this month.</b></font>"

     End If

       clearFields("a")

 End Sub

  Protected Function getRowColor(thisI As Integer) As String

     If (thisI Mod 2 > 0) Then

         Return "#E7EFF7"

     Else

         Return "#FFFFFF"

     End If

  End Function

  Sub clearFields(thisButton As String)

     If (thisButton = "a") Then

          SubmitAddBtn.Visible = True

         SubmitEditBtn.Visible = False

     End If

      If (thisButton = "e") Then

          SubmitAddBtn.Visible = False

         SubmitEditBtn.Visible = True

     End If

     MeetingInfoRvw.Text = ""

     MeetingDatetxt.Text = ""

     elm1.Text = ""

  End Sub

  Sub clearPreview()

     'MeetingInfoRvw.Text = ""

 End Sub

  Protected Sub YearDD_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles YearDD.SelectedIndexChanged

     MonthDD.SelectedIndex = 0

     getNotesList()

 End Sub

End Class

 

Any ideas?


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>