问题描述:

I have a text box that is filled in with a date based on the Calendar.js file that I use (can be found at http://www.mattkruse.com/javascript/calendarpopup/source.html)

The user clicks on the image button, which pops open a calendar and then fills the textbox.

It clearly works when I use it; however, when I debug my VB.net coding in Visual Studios the textbox shows empty:

Any suggestions why this is happening? I will need to read the string in the textbox later. I need to somehow convert the text that is filled from the Calander.js file and save it as a string inside the textbox.

<script type="text/javascript" id="js1">

var cal1 = new CalendarPopup();

</script>

HTML:

<td style="padding-top:20px; padding-left:15px;">

<asp:TextBox runat="server" id ="CERT_AGENCY_EXP1" Cssclass="fieldrequired" name="Agency1 Date Txt" size="10" maxlength="10" BackColor="#CCCCCC" ReadOnly="True" TabIndex="40"/>

<asp:ImageButton name="anchor1" id="anchor1" runat="server" style="padding-top:30px; float:left;" value=""/>

<img src="Images/calendar.png" value=""

onClick="cal1.select(document.forms[0].CERT_AGENCY_EXP1,'anchor1','MM/dd/yyyy'); return false;" title="cal1.select(document.forms[0].CERT_AGENCY_EXP1,'anchor1','MM/dd/yyyy'); return false;" name="anchor1" id="a1" />

</td>

网友答案:

Your Textbox (CERT_AGENCY_EXP1) is marked as ReadOnly. Remove that attribute and you will see the changes after the postback.

If you still want to keep the Textbox as ReadOnly, but still get the modified values do this:

    CERT_AGENCY_EXP1.Attributes.Add("readonly", "readonly")
相关阅读:
Top