我有一個名爲MonthDropDownList
的下拉列表,由sql數據源限定的月份組成。 現在我要訪問的MonthDropDownList
值一樣在下拉列表中使用增量運算符
MonthDropDownList.selecteditem++.
所以
if MonthDropDownList.selecteditem=January
then MonthDropDownList.selecteditem++=Febraury
我怎麼能做到這一點???
這是我的代碼
DataClassesDataContext db = null;
db = new DataClassesDataContext();
tblAdvance advance = new tblAdvance();
advance.StudentID = Convert.ToInt32(StudentNameDropDownList.SelectedValue);
advance.FromMonth = FromMonthDropDownList.SelectedItem.Value;
advance.UptoMonth = ToMonthDropDownList.SelectedItem.Value;
advance.AdvanceAmount = Convert.ToInt32(txtAdvanceAmount.Text);
advance.RollNo = Convert.ToInt32(txtRollNo.Text);
db.tblAdvances.InsertOnSubmit(advance);
db.SubmitChanges();
db.Connection.Close();
db.Dispose();
for (int i = FromMonthDropDownList.SelectedIndex; i <= ToMonthDropDownList.SelectedIndex;i++)
{
DataClassesDataContext dc = null;
dc = new DataClassesDataContext();
tblTotalFee bill = new tblTotalFee();
bill.StudentID = Convert.ToInt32(StudentNameDropDownList.SelectedValue);
bill.MonthName = FromMonthDropDownList.SelectedIndex [I]
bill.DueFromPreviousMonth = 0;
bill.ECAFee = 0;
bill.HostelFee = 0;
bill.LateFeeCharges = 0;
bill.MonthlyFee = 0;
bill.TransportFee = 0;
bill.TotalFeeThisMonthAlongwithDueinthismonth=0;
dc.tblTotalFees.InsertOnSubmit(bill);
dc.SubmitChanges();
I want something like the blockquoted line
dc.Connection.Close();
dc.Dispose();
}
簡而言之,我有上月和下月作爲兩個下拉列表。然後我有一個循環裏面,如果我把上月作爲一月和下月作爲3月然後上月++應該febraury和再次uppermonth ++必須暗示行軍.....這是我的實際要求@Shekhar – 2013-04-11 12:18:16