单击图像按钮时不显示Aspcalendar,并且此字段也会出现错误填充 [英] Aspcalendar is not displayed when imagebutton is clicked and also getting error fill this field

查看:58
本文介绍了单击图像按钮时不显示Aspcalendar,并且此字段也会出现错误填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net项目中有一个带有imagebutton和AspCalendar控件的输入类型文本字段。当我单击图像按钮时,页面加载事件中的日历可见性为false,并且还会在日历控件之间从上到下收到错误填写必填字段。



我尝试过:



Html代码:

I have a input type text field with imagebutton and AspCalendar controls in an asp.net project. When i am clicking the image button then the calendar visibility false in pageload event and also getting the error "Fill out required fields" from top to bottom in between calendar controls appears.

What I have tried:

Html Code:

<%-- Start Date --%>
<div class="form-group row">
    <label for="inputTxtStartDate" class="col-sm-2 col-form-label">Start Date</label>
    <div class="col-10">
        <input type="text" id="inputTxtStartDate" name="inputTxtStartDate" class="form-control-sm" runat="server" />
        <asp:ImageButton ID="imgBtnStartDateCalendar" runat="server" ImageUrl="~/Images/Calendar.ico" Width="20px" OnClick="imgBtnStartDateCalendar_Click" CausesValidation="false" />
        <asp:Calendar ID="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged" NextPrevFormat="FullMonth" SelectionMode="DayWeekMonth" SelectMonthText="Month" SelectWeekText="Week" ForeColor="WhiteSmoke" DayNameFormat="Full" Font-Names="Book Antiqua" Font-Size="XX-Small">
            <DayHeaderStyle BackColor="DarkOliveGreen" />
            <DayStyle BackColor="DarkKhaki" BorderColor="Khaki" BorderWidth="1" Font-Bold="true" Font-Italic="true" />
            <NextPrevStyle Font-Italic="true" Font-Names="Arial CE" />
            <OtherMonthDayStyle BackColor="SeaGreen" BorderColor="DarkSeaGreen" />
            <SelectedDayStyle BackColor="Green" BorderColor="SpringGreen" />
            <SelectorStyle BackColor="DarkOliveGreen" ForeColor="Snow" Font-Names="Times New Roman Greek" Font-Size="Small" BorderColor="Olive"                                                BorderWidth="1" />
            <TitleStyle BackColor="DarkGreen" Height="35" Font-Size="XX-Small" Font-Names="Courier New Baltic" />
        </asp:Calendar>
    </div>
</div>





代码背后:



PageLoad事件:



Code Behind:

PageLoad Event:

Calendar1.Visible = false;





ImageButton Click事件:



ImageButton Click Event:

if (Calendar1.Visible == true)
    Calendar1.Visible = false;
else
    Calendar1.Visible = true;

推荐答案

问题已修复....解决方案在这里只是HTML输入标签.....我刚删除输入标签并更改为asp文本框并修复了问题。



现在按预期射击,之前我正在使用Updatepanel。在Updatepanel里面我也有占位符。在占位符内部有一个表单域,其中一个字段是imagebutton,calendar和textbox。
Problem is fixed.... The solution is here is only HTML input tags..... I just deleted input tags and changed to asp textbox and fixed the problem.

Now it is firing as expected and previously i am having Updatepanel. Inside Updatepanel i am having placeholder also. Inside placeholder there is a form fields in which one of the field is imagebutton, calendar, and textbox.


这篇关于单击图像按钮时不显示Aspcalendar,并且此字段也会出现错误填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆