我有一个要求,我必须删除下拉项取决于开始日期和结束日期。 这里的问题是,它会引发输入字符串格式不正确的错误。输入字符串格式不正确。如何纠正?
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