本文整理汇总了C#中System.Web.UI.WebControls.ListItem.Count方法的典型用法代码示例。如果您正苦于以下问题:C# ListItem.Count方法的具体用法?C# ListItem.Count怎么用?C# ListItem.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.ListItem
的用法示例。
在下文中一共展示了ListItem.Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnBackword_Click
protected void btnBackword_Click(object sender, EventArgs e)
{
try
{
int[] arr = lstcategory.GetSelectedIndices();
ListItem[] li = new ListItem[arr.Length];
int cnt = 0;
foreach (GridViewRow row in gridStudentInfo.Rows)
{
for (int i = 0; i < arr.Length; i++)
{
int FlagId = Convert.ToInt16(row.Cells[4].Text);
int ListFlagId = Convert.ToInt16(lstcategory.Items[arr[i]].Value.ToString());
if (FlagId == ListFlagId)
{
row.Visible = true;
li[cnt] = new ListItem(lstcategory.Items[arr[i]].Text, lstcategory.Items[arr[i]].Value.ToString());
cnt++;
}
}
}
for (int i = 0; i < li.Count(); i++)
{
lstcategory.Items.Remove(li[i]);
}
}
catch (Exception ex)
{
}
}
示例2: GetCourseList
public void GetCourseList()
{
DropDownListCourse.Items.Clear();
try
{
ListItem[] _listCourse = _inBloomApi.GetCourseBySchool(DropDownListSchool.SelectedItem.Value.ToString());
_user = (User)Session["UserDetail"];
if (_user.IsAdminUser || IsLeader())
{
_inBloomApi.GetSectionByStaffIdAndSchoolId(dropDownListStaff.SelectedItem.Value, DropDownListSchool.SelectedItem.Value);
//_sectionAndCourseOfferingId=> sectionid and courseofferingid
ListItem[] _sectionAndCourseOfferingId = _inBloomApi.GetSectionAndCourseOfferingIdList();
ListItem[] _temp = new ListItem[_sectionAndCourseOfferingId.Count()];
ListItem[] _courseIdAndCourseOfferingId = new ListItem[_sectionAndCourseOfferingId.Count()];
for (int i = 0; i < _sectionAndCourseOfferingId.Count(); i++)
{
ListItem _course = _inBloomApi.GetCourseBySectionCourseOfferingId(_sectionAndCourseOfferingId[i].Value);
_temp[i] = new ListItem(_course.Text, _course.Value);
_courseIdAndCourseOfferingId[i] = new ListItem(_course.Value, _sectionAndCourseOfferingId[i].Value);
}
DropDownListCourse.Items.AddRange(_temp);
Course course = new Course(_temp);
Session["Course"] = course;
Session["SectionAndCourseOfferingId"] = _sectionAndCourseOfferingId;
Session["CourseIdAndCourseOfferingId"] = _courseIdAndCourseOfferingId;
}
else
{
if (!IsEducator())
{
_inBloomApi.GetSectionByStaffIdAndSchoolId(dropDownListStaff.SelectedItem.Value, DropDownListSchool.SelectedItem.Value);
}
else
{
_inBloomApi.GetSectionListForLoginUser();
}
ListItem[] _sectionAndCourseOfferingId = _inBloomApi.GetSectionAndCourseOfferingIdList();
ListItem[] _temp = new ListItem[_sectionAndCourseOfferingId.Count()];
ListItem[] _courseIdAndCourseOfferingId = new ListItem[_sectionAndCourseOfferingId.Count()];
if (_listCourse != null)
{
for (int i = 0; i < _sectionAndCourseOfferingId.Count(); i++)
{
ListItem _course = _inBloomApi.GetCourseBySectionCourseOfferingId(_sectionAndCourseOfferingId[i].Value);
// check more than one course
bool IsCoursePresent = false;
for (int j = 0; j < _temp.Count(); j++)
{
if (_temp[j] != null)
{
if (_temp[j].Value == _course.Value)
{
IsCoursePresent = true;
break;
}
}
}
if (IsCoursePresent)
{
}
else
{
_temp[i] = new ListItem(_course.Text, _course.Value);
}
_courseIdAndCourseOfferingId[i] = new ListItem(_course.Value, _sectionAndCourseOfferingId[i].Value);
//for (int Index = 0; Index < _listCourse.Count(); Index++)
//{
// bool Find = _inBloomApi.IsSectionContainOfferingOfThisCourse(_sectionAndCourseOfferingId[i].Value, _listCourse[Index].Value);
// if (Find)
// {
// _temp[i] = new ListItem(_listCourse[Index].Text, _listCourse[Index].Value);
// _courseIdAndCourseOfferingId[i] = new ListItem(_listCourse[Index].Value, _sectionAndCourseOfferingId[i].Value);
// break;
// }
//}
}
//DropDownListCourse.Items.AddRange(_listCourse);
//Course course = new Course(_listCourse);
//Session["Course"] = course;
for (int i = 0; i < _temp.Count(); i++)
{
if (_temp[i] != null)
DropDownListCourse.Items.Add(_temp[i]);
}
// DropDownListCourse.Items.AddRange(_temp);
Course course = new Course(_temp);
//.........这里部分代码省略.........
示例3: GetCourseListNew
public void GetCourseListNew()
{
try
{
_user = (User)Session["UserDetail"];
DropDownListCourse.Items.Clear();
ListItem[] _sectionList = null;
if (_user.IsAdminUser || IsLeader())
{
_sectionList = _inBloomApi.GetSectionByStaffIdAndSchoolId(dropDownListStaff.SelectedItem.Value, DropDownListSchool.SelectedItem.Value);
}
else
{
_sectionList = _inBloomApi.GetSectionListForLoginUser();
}
ListItem[] _sectionAndCourseOfferingId = _inBloomApi.GetSectionAndCourseOfferingIdList();
ListItem[] _temp = new ListItem[_sectionAndCourseOfferingId.Count()];
ListItem[] _courseAndSectionIdTemp = new ListItem[_sectionAndCourseOfferingId.Count()];
ListItem[] _sectionAndCourseIdTemp = new ListItem[_sectionAndCourseOfferingId.Count()];
for (int i = 0; i < _sectionAndCourseOfferingId.Count(); i++)
{
ListItem _course = _inBloomApi.GetCourseBySectionCourseOfferingId(_sectionAndCourseOfferingId[i].Value);
bool IsPresent = false;
for (int j = 0; j < _temp.Count(); j++)
{
if (_temp[j] != null)
{
if (_temp[j].Value == _course.Value)
{
IsPresent = true;
break;
}
}
}
if (!IsPresent)
{
_temp[i] = new ListItem(_course.Text, _course.Value);
}
_courseAndSectionIdTemp[i] = new ListItem(_course.Value, _sectionList[i].Value);
_sectionAndCourseIdTemp[i] = new ListItem(_sectionList[i].Value, _course.Value);
}
for (int i = 0; i < _temp.Count(); i++)
{
if (_temp[i] != null)
{
DropDownListCourse.Items.Add(_temp[i]);
}
}
//DropDownListCourse.Items.AddRange(_temp);
Course course = new Course(_temp);
Session["Course"] = course;
Session["CourseAndSectionIdTemp"] = _courseAndSectionIdTemp;
Session["SectionAndCourseIdTemp"] = _sectionAndCourseIdTemp;
}
catch (Exception Ex)
{
}
}
示例4: GetFlagListOfStaffForAdminUser
public Temp[] GetFlagListOfStaffForAdminUser(User _user, String EducationOrganizationId, ListItem[] _schoolList)
{
Temp[] _temp = null;
try
{
for (int i = 0; i < _schoolList.Count(); i++)
{
Temp[] _tempStaff = null;
JArray _staffResponse = JArray.Parse(RestApiHelper.CallApi("schools/" + _schoolList[i].Value + "/teacherSchoolAssociations/teachers", this._accessToken));
if (_staffResponse != null)
{
String CustomLink = "";
_tempStaff = new Temp[_staffResponse.Count()];
for (int Index = 0; Index < _staffResponse.Count(); Index++)
{
JArray Links = JArray.Parse(_staffResponse[Index]["links"].ToString());
for (int j = 0; j < Links.Count; j++)
{
String Relation = _authenticateUser.GetStringWithoutQuote(Links[j]["rel"].ToString());
if (Relation.Equals("custom"))
{
CustomLink = _authenticateUser.GetStringWithoutQuote(Links[j]["href"].ToString());
Temp _response = GetCustomForStaff(CustomLink);
_tempStaff[Index] = new Temp();
_tempStaff[Index] = _response;
break;
}
}
if (_temp == null)
{
_temp = new Temp[_tempStaff.Count()];
for (int j = 0; j < _tempStaff.Count(); j++)
{
_temp[j] = new Temp();
_temp[j] = _tempStaff[j];
}
}
else
{
// store _temp array into another
Temp[] _forTemp = new Temp[_temp.Count()];
for (int j = 0; j < _temp.Count(); j++)
{
_forTemp[j] = new Temp();
_forTemp[j] = _temp[j];
}
// get newly added staff temp
_temp = new Temp[_tempStaff.Count() + _temp.Count()];
for (int j = 0; j < _tempStaff.Count(); j++)
{
_temp[j] = new Temp();
_temp[j] = _tempStaff[j];
}
// get previous staff
int k = 0;
for (int j = _tempStaff.Count(); j < _tempStaff.Count() + _forTemp.Count(); j++)
{
_temp[j] = new Temp();
_temp[j] = _forTemp[k];
k = k + 1;
}
}
}
}
}
// check for the blank
int totalBlank = 0;
for (int i = 0; i < _temp.Count(); i++)
{
if (_temp[i] == null)
totalBlank = totalBlank + 1;
}
Temp[] _returnTemp = new Temp[_temp.Count() - totalBlank];
int p = 0;
for (int i = 0; i < _temp.Count(); i++)
{
if (_temp[i] != null)
{
_returnTemp[p] = new Temp();
_returnTemp[p] = _temp[i];
p++;
}
}
return _returnTemp;
}
catch (InRowChangingEventException Ex)
{
return null;
}
}