I am using calendar extender to create a popup textbox when a user click in a specific textboxk:
<asp:Label ID="searchDateFromLabel" runat="server" Text="From:"></asp:Label>
<asp:TextBox ID="searchDateFrom" runat="server" ></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="fromCalendarExtender" TargetControlID="searchDateFrom" runat="server">
</ajaxToolkit:CalendarExtender>
<asp:Label ID="searchDateToLabel" runat="server" Text="To:"></asp:Label>
<asp:TextBox ID="searchDateTo" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="toCalendarExtender" TargetControlID="searchDateTo" runat="server">
</ajaxToolkit:CalendarExtender>
Additionally, I populate the textboxes with default dates on page load:
fromCalendarExtender.SelectedDate = DateTime.Today.AddDays(-30);
toCalendarExtender.SelectedDate = DateTime.Now;
The issue I am having is that when a user clicks a textbox that is populated, it won't let them choose another date (other than the one the texbox was populated with) unless they first delete the text currently in the box.
How do I allow them to select any date?
Set PopupControlID to the TextBox you are trying use to select the date. It should then force the data-selector to pop up whenever the user gives focus to the TextBox.
Related
I want to use a single asp page to display a logon screen (2 boxes for user id and password). I placed these in a asp:panel on the client page. When the user logs on, the code behind sets the login panel's visible attribute to off and a separate data panel to visible. This works fine. When the user pushes a Logoff button on the second page, I reverse the process to display the log on page again. I also TRY to set the user name and password boxes to empty but the TextBox.Text = "" is ignored (performed in the code behind).
Is this a perverted use of panels or am I missing a setting?
The code looks like this:
In default.asp:
<!––
// display the login panel
-->
<asp:Panel ID="Panel_login" runat="server" visible="true" >
<asp:TextBox ID="TextBox_userID" runat="server" Font-Size="Small" Width="200px">
</asp:TextBox>
<asp:TextBox ID="TextBox_password" TextMode="Password" runat="server" Font-Size="Small" Width="200px"></asp:TextBox>
<asp:Button ID="Button_login" runat="server" BorderStyle="Ridge" Font-Size="Small" OnClick="Button_login_Click" Text="Log In" />
</asp:Panel>
In the Code behind:
Panel_selectSession.Visible = false;
Panel_login.Visible = true;
TextBox_userID.Text = "";
TextBox_password.Text = "";
Label4_msg.Text = "";
The 2 Textbox sets are ignored but the label set works because it is outside the panel.
Thanks
I am using ASP.NET and C# couple text boxes to calculate results entered. Textbox2 has a value entered and on button click Textbox1 gets populated. This works fine the first time I enter the value. But the second time I change the value in Textbox2, I see that the value is being assigned to Textbox1 while debugging on Button click, but doesn't show up on the screen. I have many other controls and a master page. The textboxes are within an update panel.
Can someone help me what's going on?
Here is the code:
<asp:TextBox ID="Textbox1" runat="server" Width="150px" TabIndex="6" MaxLength="8"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="TextBox1" ErrorMessage="*"></asp:RequiredFieldValidator>
<asp:TextBox runat="server" ID="Textbox2" Width="150px" Visible="false"></asp:TextBox> 
<asp:ImageButton runat="server" ID="imgCalcAdjRate" ImageUrl="~/Resource/Images/calrate_0.bmp" onmouseout="this.src='../Resource/Images/calrate_0.bmp'" onmouseover="this.src='../Resource/Images/calrate_1.bmp'" Height="25px" Width="25px" Visible="false" onclick="imgCalcAdjRate_Click" />
Check the postback in the page_load function.
if(!Page.IsPostBack) {
}
I think you are loosing information on post back. The data is changed, but it get reset on post back.
I am using ASP.NET and C# couple text boxes to calculate results entered. Textbox2 has a value entered and on button click Textbox1 gets populated. This works fine the first time I enter the value. But the second time I change the value in Textbox2, I see that the value is being assigned to Textbox1 while debugging on Button click, but doesn't show up on the screen. I have many other controls and a master page. The textboxes are within an update panel.
Can someone help me what's going on?
Here is the code:
<asp:TextBox ID="Textbox1" runat="server" Width="150px" TabIndex="6" MaxLength="8"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="TextBox1" ErrorMessage="*"></asp:RequiredFieldValidator>
<asp:TextBox runat="server" ID="Textbox2" Width="150px" Visible="false"></asp:TextBox> 
<asp:ImageButton runat="server" ID="imgCalcAdjRate" ImageUrl="~/Resource/Images/calrate_0.bmp" onmouseout="this.src='../Resource/Images/calrate_0.bmp'" onmouseover="this.src='../Resource/Images/calrate_1.bmp'" Height="25px" Width="25px" Visible="false" onclick="imgCalcAdjRate_Click" />
Check the postback in the page_load function.
if(!Page.IsPostBack) {
}
I think you are loosing information on post back. The data is changed, but it get reset on post back.
I have the following textBox -
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="true"></asp:TextBox>
<asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
MinimumPrefixLength="1" ServiceMethod="PRETURN" ServicePath="WebService1.asmx"
TargetControlID="TextBox1"> </asp:AutoCompleteExtender>
When a user types into TextBox1 this sends a request to WebService1.asmx and calls the PRETURN service method. So as a user is typing the textBox brings a drop down list of strings that start with the letters the user is typing.
I now have the following DataList -
<asp:DataList runat="server" ID="pTextBox" >
<ItemTemplate>
<asp:CheckBox ID="CheckBoxPN" runat="server" Checked='false' OnCheckedChanged="CheckBoxPN_CheckedChanged" AutoPostBack="true" />
<asp:TextBox ID="profileTextBox" runat="server" Text='<%# Container.DataItem.ToString() %>'></asp:TextBox>
</ItemTemplate>
</asp:DataList>
Where on Page_Load -
WebService1 ws = new WebService1();
pTextBox.DataSource = ws.Method();
pTextBox.DataBind();
My problem is I want to combine the functionality of the textBox with the DataList. So that when a user types into the textBox, instead of the textBox having a dropdown list, the rows in the DataList are updated. So for instance, if Text in the profileTextBox did not contain the prefix text in TextBox1 when the user was typing, it would disappear. Leaving the user with a list of rows relevant to their search. How can I achieve this?
Others have done something similar to the GridView control, using JQuery to show/hide rows depending on the filter criteria. One solution, which should be easily adaptable to the DataList, is available here.
I am new person in asp.net. I have one text box and one calender image button in my asp.net application. I use the masked extender to display date in the textbox like yyyy-mm--dd. Also i use the calender extender for the purpose of clicking image button it will show the date in the textbox. I use the following code.
<asp:ImageButton ID="imgdatefrom" runat="server"
ImageUrl="~/images/calendar.jpeg" Height="19px" Width="20px" />
<asp:Label ID="lblTo" runat="server" Text="End Date"
ForeColor="Black" Font-Size="Small"></asp:Label>
<asp:Label ID="enddateval" runat="server" ForeColor="Red" Text="*"></asp:Label>
<asp:CalendarExtender ID="txtDateFrom_CalendarExtender" runat="server" TargetControlID="txtDateFrom" Format="yyyy-MM-dd" PopupButtonID="imgdatefrom"
TodaysDateFormat="yyyy d, MMMM">
</asp:CalendarExtender>
While I executing that code and selecting date by clicking image button the selected date will not displayed in the textbox. Can anyone know how to solve the problem.
Thank you
Instead of MaskedExtender you just use standard TextBox Control. It will work.