I have two fields Renwal date and Date of cheque. for that i use two text boxes.Then i want to use one calendar to fill the renwal date and date of cheque in respective text boxes.
how to do in csharp. please help me.
Thanks!
Renwal date textbox1 Calendar
Date of cheque textbox2 Calendar
for that i want to use one calendar only.
Loading
Satyapriya NayakPosted Jun 10, 2012, 2:45 PM
Try this...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm6.aspx.cs" Inherits="WebApplication16.WebForm6" %>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace WebApplication16
{
public partial class WebForm6 : System.Web.UI.Page
{
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(TextBox1.Text))
{
if (String.IsNullOrEmpty(TextBox2.Text))
{
TextBox1.Text = Calendar1.SelectedDate.Date.ToString();
}
else if (!String.IsNullOrEmpty(TextBox2.Text) && (TextBox2.Text != Calendar1.SelectedDate.Date.ToString()))
{
TextBox1.Text = Calendar1.SelectedDate.Date.ToString();
}
}
else if (String.IsNullOrEmpty(TextBox2.Text))
{
if (String.IsNullOrEmpty(TextBox1.Text))
{
TextBox2.Text = Calendar1.SelectedDate.Date.ToString();
}
else if (!String.IsNullOrEmpty(TextBox1.Text) && (TextBox1.Text != Calendar1.SelectedDate.Date.ToString()))
{
TextBox2.Text = Calendar1.SelectedDate.Date.ToString();
}
}
}
}
}
Thanks