我使用了文本框和圖片按鈕。點擊圖片按鈕後,日曆快訊會出現,並且在calendarextender中選擇的日期應該填入textbox.but日期爲不填充。請引導我解決這個問題。從calendarextender中選擇的日期不填充在asp.net文本框中
這裏是我的代碼
<asp:TextBox ID="txtAccidentDate" MaxLength="10" Text=""
runat="server" SkinID="ClaimTextBox" Width="80px" TabIndex="1" />
<cc1:MaskedEditExtender ID="MaskedEditExtender2" runat="server"
TargetControlID="txtAccidentDate" Mask="99/99/9999"
MessageValidatorTip="false" MaskType="Date"
DisplayMoney="Left" AcceptNegative="Left"
ErrorTooltipEnabled="True" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="txtAccidentDate"
Display="None"
ErrorMessage="Please select Accident Date"
ValidationGroup="Insured" SetFocusOnError="true">
</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="txtAccidentDate"
ValidationGroup="Insured" Display="None"
ErrorMessage="Please Enter valid Date"
SetFocusOnError="true"
ValidationExpression="(((0?[1-9]|1[012])[/.](0?[1-9]|1\d|2[0-8])|(0?[13456789]|1[012])[/.](29|30)|(0?[13578]|1[02])/31)[/.](19|[2-9]\d)\d{2}|0?2[/.]29[/.]((19|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))">
</asp:RegularExpressionValidator>
<cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender5"
runat="server" Enabled="True"
TargetControlID="RegularExpressionValidator2">
</cc1:ValidatorCalloutExtender>
<cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender6"
runat="server" Enabled="True"
TargetControlID="RequiredFieldValidator1">
</cc1:ValidatorCalloutExtender>
<cc1:CalendarExtender ID="CalendarExtender2"
runat="server" Enabled="True"
PopupButtonID="imgcal" Format="MM/dd/yyyy"
TargetControlID="txtAccidentDate" />
<asp:ImageButton ID="imgcal" runat="server" CausesValidation="false"
ImageUrl="~/Images/Calendar_scheduleHS.png" />
<span class="helpInformantion">(mm/dd/yyyy)</span>
你可以試試沒有MaskedEditExtender控件的文本框。我記得有一段時間我以前遇到類似的問題,其中一個MaskedEditExtender控件與CalendarExtender衝突。 –
檢查此鏈接也http://stackoverflow.com/questions/5463258/using-a-calendarextender-with-a-maskededitextender –