There's a web page that has a ModalPopUp Extender, with a form & 2 textboxes. 1 Textbox with Date, 1 textbox for info. When you click on Submit - it checks to see if the date has already been entered. If ok then adds to database. If already entered then there's a javascript alert pop up - then display the modal. I'm trying to populate the textbox fields and it's not working. The alert shows up and then the Modal shows up but no textboxes are filled.
Do you show the popup modal then populate the textbox fields or reverse?
Here's the aspx code. ~~~~~~~~~~~~~~~~~~~~~~~~~~
<div id="divPopUPAdd" class="contents" runat="server" ><ajaxToolkit:ModalPopupExtender ID="mpe1" runat="server" BehaviorID="mpe1" TargetControlID="AddNewLinkBtn" PopupControlID="divPopUPAdd" BackgroundCssClass="modalBackgroundClass" DropShadow="false" OnOkScript="confirmduplicate()"></ajaxToolkit:ModalPopupExtender><table cellpadding="0" cellspacing="0" style="width: 900px;" border="0"><tr><td> </td><td align="left" class="textBold">Meeting Date<font color="#990000">*</font>:</td><td align="left"><asp:TextBox ID="MeetingDatetxt" runat="server" style="margin-bottom: 0px" Width="78px" ></asp:TextBox><asp:RequiredFieldValidator ID="AddDateVld" runat="server" ErrorMessage="Please enter a date" ControlToValidate="MeetingDatetxt" Display="Dynamic" SetFocusOnError="True" ForeColor="#990000"></asp:RequiredFieldValidator><asp:CompareValidator ID="CheckDateVld" runat="server" ErrorMessage="* Enter a valid date" ControlToValidate="MeetingDatetxt" Display="Dynamic" Operator="DataTypeCheck" Type="Date" SetFocusOnError="True" ForeColor="#990000"/><strong>(m/d/yy)</strong></td><td style="width: 500px;" 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></td><td> </td></tr><tr><td> </td><td class="textBold" align="left" colspan="3">Meeting Notes Text<font color="#990000">* </font>:</td><td> </td></tr><tr><td style="height: 6px;"></td><td colspan="3" class="textBold"><asp:Label ID="ErrorMeetingNotesLBL" runat="server" Text="" ForeColor="#990000" Visible="false">Please enter information on the meeting</asp:Label></td><td></td></tr><tr><td> </td><td colspan="3" align="left"><asp:TextBox ID="elm1" runat="server" TextMode="MultiLine" ClientIDMode="Static" Width="700px" Height="200px" ></asp:TextBox></td><td> </td></tr><tr><td> </td><td colspan="3" align="right"><%--~~~~~~~~~~ The following button keeps the Review Panel Active. a TargetControlID is required. ~~~~~~~~~~~--%><asp:Button ID="PreviewNotesBtn" Text="Preview Notes" CausesValidation="False" runat="server" Style="display: none;" /> <asp:Button ID="btnHide" runat="server" Text="Cancel" OnClick="btnHide_Click" CausesValidation="False" /> <asp:Button ID="SubmitAddBtn" runat="server" Text="Submit" /><asp:Button ID="SubmitEditBtn" runat="server" Text="Submit" /></td><td> </td></tr></table>
Here's the codebehind.~~~~~~~~~~~~~~~~~~~~~~~
Protected Sub SubmitAddBtn_Click(sender As Object, e As System.EventArgs) Handles SubmitAddBtn.Click '~~~~~~~~~~ CHECK TO SEE IF MEETING NOTES EMPTY If Not (String.IsNullOrEmpty(elm1.Text)) Then Dim mDate As Date = DateTime.Parse(MeetingDatetxt.Text, New System.Globalization.CultureInfo("en-US")) Dim mText As String = HttpUtility.HtmlEncode(elm1.Text) '~~~~~~~~ CHECK TO SEE IF DATE / RECORD ALREADY IN DATABASE ~~~~~~~~~~~~ Dim param As SqlParameter() = New SqlParameter(0) {} param(0) = New SqlParameter("@sDate", mDate) Dim dr As SqlDataReader Dim strSQL As String strSQL = "Select * FROM MeetingNotes WHERE meetingDate = '" & mDate.ToString("yyyy/MM/dd") & "'" Dim i As Integer = 0 dr = DRITSQL.GetDataReaderSQL(strSQL) Do While dr.Read i = i + 1 Loop dr.Close() If (i > 0) Then MeetingDatetxt.Text = "ksksks" ScriptManager.RegisterClientScriptBlock(Me.Page, GetType(String), "confirmduplicate", "confirmduplicate();", True) mpe1.Show() Else ~~~~~~~~~ Enter into database ~~~~~~~~~~~~