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

Assigning Text to ModalPopUpExtender Textbox

$
0
0

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>&nbsp;</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>&nbsp;</td></tr><tr><td>&nbsp;</td><td  class="textBold" align="left" colspan="3">Meeting Notes Text<font color="#990000">*&nbsp;</font>:</td><td>&nbsp;</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> &nbsp;</td><td colspan="3" align="left"><asp:TextBox ID="elm1" runat="server" TextMode="MultiLine"
                        ClientIDMode="Static"  Width="700px" Height="200px" ></asp:TextBox></td><td> &nbsp;</td></tr><tr><td>&nbsp;</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;" />&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>

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      ~~~~~~~~~~~~ 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



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