Add 14 days to the current date Current date: Date in 2 weeks: Markup Page Current date: <asp:TextBox ID=”TodayDt” runat=”server” > Date in 2 weeks: <asp:TextBox ID=”DaysAhead” runat=”server” > Code Behind TodayDt.Text = Date.Now.ToShortDateString DaysAhead.Text = Date.Now.AddDays(-Date.Now.DayOfWeek).AddDays(14).ToShortDateString Substract 14 days from current date Current date: Date 2 weeks ago: Markup Page Current date: <asp:TextBox ID=”TodayDt” […]
Archive for the 'VS2010' Category
Count number of characters in textbox
Markup Page <strong>Required Info:</strong> <asp:Label ID=”TotCharReqInfo” runat=”server” ></asp:Label> <strong>Body Length:</strong> <span id=”BodyLength”>0 <strong>Total Length:</strong> <span id=”TotLength”> <asp:Label ID=”TotLengthLbl” runat=”server” ></asp:Label> <strong>Left:</strong> <span id=”CharLeft”> <asp:Label ID=”ChLeft” runat=”server” ></asp:Label> <asp:TextBox id=”txtInputOnln” runat=”server” TextMode=”MultiLine” Width=”300px” Height=”90px” MaxLength=”350″ onKeyUp=”Count(this,350)” onChange=”Count(this,350)”/> Click to read more… <script type=”text/javascript”> var ChLeftVar = “<%=CharLeftInt %>”; var ChLeftOut var ChLefVar2 function count(clientId) { var txtInputOnln = […]
ASP.NET Validator – validate one of the two values
Validate one of the two textbox values Markup page Please enter on of at least one contact point: <asp:CustomValidator ID=”ContactInfoAlert” runat=”server” ErrorMessage=”CustomValidator” OnServerValidate=”CustomValidator_ServerValidate”> </asp:CustomValidator> User email: <asp:TextBox ID=”EmailTbx” runat=”server” ToolTip=”Enter email.” > </asp:TextBox> User phone: <asp:TextBox ID=”PhoneTbx” runat=”server” ToolTip=”Enter phone number.” > </asp:TextBox> <asp:Button ID=”Btn1″ runat=”server” Text=”Next” CausesValidation=”true”/> Click to read more… Code-behind page Protected […]