how to create data picker using drop down list and text box asp.net , sql server
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial
class OR_Default
: System.Web.UI.Page
{
protected void Page_Load(object
sender, EventArgs e)
{
int i;
for (i
= 1; i <= 31; i++)
{
DropDownListDAY.Items.Add(Convert.ToString(i));
}
DropDownListMONTH.Items.Add("JAN");
DropDownListMONTH.Items.Add("FEB");
DropDownListMONTH.Items.Add("MAR");
DropDownListMONTH.Items.Add("APR");
DropDownListMONTH.Items.Add("MAY");
DropDownListMONTH.Items.Add("JUN");
DropDownListMONTH.Items.Add("JUL");
DropDownListMONTH.Items.Add("AUG");
DropDownListMONTH.Items.Add("SEPT");
DropDownListMONTH.Items.Add("NOV");
DropDownListMONTH.Items.Add("DEC");
int X;
for (X
= 1900; X <= 2000; X++)
{
DropDownListYEAR.Items.Add(Convert.ToString(X));
}
}
string
sday;
string
sMonth;
string
sYear ;
protected void ButtonDATE_Click(object
sender, EventArgs e)
{
sday = Convert.ToString(DropDownListDAY.SelectedItem.Text);
sMonth = Convert.ToString(DropDownListMONTH.SelectedItem.Text);
sYear = Convert.ToString(DropDownListYEAR.SelectedItem.Text);
// string
sDate = sday + "/" + sMonth + "/" + sYear;
string
sDate=DropDownListDAY.SelectedItem.Text+"/"+DropDownListMONTH.SelectedItem.Text+"/"+DropDownListYEAR.SelectedItem.Text;
Convert.ToString(
TextBoxDATE.Text=sDate );
}
}
Contact : +91-9040573923, +91-7008182025
http://sradhawebcreations.com/
http://sradhawebcreations.blogspot.in/
https://facebook.com/sradhawebcreations
http://sradhawebcreations.com/
http://sradhawebcreations.blogspot.in/
https://facebook.com/sradhawebcreations
No comments:
Post a Comment