我有一個要求,我必須刪除下拉項取決於開始日期和結束日期。 這裏的問題是,它會引發輸入字符串格式不正確的錯誤。輸入字符串格式不正確。如何糾正?
foreach (SPListItem oSPListItemCourse in oSPListItemCollectionCourse)
{
string begginingDate = oSPListItemCourse["Start Date"].ToString();
string finishDate = oSPListItemCourse["End Date"].ToString();
if ((Convert.ToInt32(begginingDate)>=Convert.ToInt32(TxtStartDate.Text)) || (Convert.ToInt32(finishDate)<= Convert.ToInt32(TxtEndDate.Text)))//input string not in correct format
{
ddlDrop.Items.Remove(ddlDrop.SelectedItem);//how to remove the item from drop down if their date is greater than StartDate and less than EndDate
}
}
可能重複的[輸入字符串格式不正確,並從下拉列表中刪除下拉項目](http://stackoverflow.com/questions/9477248/input-string-was-not-in-correct-format-並從下拉列表中刪除項目) – 2012-02-29 14:41:49