i已将这些详细信息保存在数据库中并绑定到网格视图 每当开始日期超过我想要的一个月时将支付价值更新为双倍 就像我想要更新3个月的付款(例如3个月5000 + 5000 + 5000 = 15000) 这是我的代码 i have saved these details in database and binded to grid viewwhenever the start date is crossed one month i want to update payment value to double like that i want to update payment for 3 months(example for 3 months 5000+5000+5000=15000 )this is my code SqlConnection con = new SqlConnection(@"server=SYS8\SQLSERVER2008DE;database=Naresh;Integrated Security=true"); protected void Page_Load(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand("select * from ValueUpdate", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); } protected void txtStartDate_TextChanged(object sender, EventArgs e) { string inputString = txtStartDate.Text; DateTime dt = DateTime.ParseExact(inputString, "MM/dd/yyyy", CultureInfo.InvariantCulture); dt = dt.AddMonths(Convert.ToInt32(ddlmonths.SelectedItem.ToString())); txtEndDate.Text = dt.ToString("MM/dd/yyyy"); } protected void Button1_Click(object sender, EventArgs e) { con.Open(); SqlCommand cmd = new SqlCommand("Insert into ValueUpdate (NoOfMonths,StartDate,EndDate,Payment) values('" + ddlmonths.SelectedItem + "','" + txtStartDate.Text + "','" + txtEndDate.Text + "','" + txtMonthlyPay.Text + "')", con); cmd.ExecuteNonQuery(); 推荐答案 WHen you update a value of input with script , change event is not triggered, so you need to trigger it yourself. You can use events within datepicker to manage this: ( #datepicker)。datepicker({ altField: #selected_day, altFormat: DD, onSelect:function(){("#datepicker").datepicker({ altField: "#selected_day", altFormat: "DD", onSelect:function(){ (' #selected_day')。change()} }); DEMO:http://jsfiddle.net/c3u5B/12/ ('#selected_day').change() } });DEMO:http://jsfiddle.net/c3u5B/12/ 这篇关于如何在更改日期时更新文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-24 11:10