function checkDate(sender,args) { //create a new date var and set it to the //value of the senders selected date var selectedDate = new Date(); selectedDate = sender._selectedDate; //create a date var and set it's value to today var todayDate = new Date(); var mssge = ""; if( todayDate -selectedDate >=18) { / alert("Warning! - Date of Birth is valid "); } } Date Of Birth "width: 292px"> "TextBox3" runat="server" ValidationGroup="a"> "CalendarExtender2" targetcontrolid="TextBox3" runat="server" OnClientDateSelectionChanged="checkDate">> "ValidatorCalloutExtender3" runat="server" TargetControlID="RequiredFieldValidator3"> "RequiredFieldValidator3" runat="server" ErrorMessage="RequiredFieldValidator" Display="None" ControlToValidate="TextBox3" SetFocusOnError="True" ValidationGroup="a"> "Button1" runat="server" Text="Insert" ValidationGroup="a" onclick="Button1_Click" style="width: 48px" /> "Label2" runat="server" ForeColor="#FF6600" Text="Data Sucessfully Inserted "> Now is coding inside button protected void Button1_Click(object sender, EventArgs e) { try { string constr; constr = WebConfigurationManager.ConnectionStrings["JAPITConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(constr); con.Open(); string str = "insert into Doe_detail values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "')"; SqlCommand cmd = new SqlCommand(str, con); cmd.ExecuteNonQuery(); con.Close(); Label2.Visible = true; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; } catch (Exception es) { } }td>2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Loading
SenthilkumarPosted Apr 9, 2012, 8:20 AM
Mayur GujrathiPosted Apr 9, 2012, 7:42 AM
http://www.codeproject.com/Questions/362575/Through-Javascript-Textbox-to-show-error-Age-less