Return to Snippet

Revision: 35223
at November 4, 2010 13:18 by housecor


Initial Code
cblTeamMembers.DataSource = from t in db.TeamMembers
										 orderby t.Name
										 select t;
			cblTeamMembers.DataTextField = "Name";
			cblTeamMembers.DataValueField = "TeamMemberID";
			cblTeamMembers.DataBind();

			if (Request["ID"] != null) //so editing
			{
				courtCase = GetCase();
				if (courtCase == null) throw new HttpException(404, "file not found"); //so the ID requested wasn't found. Redirect to 404.

				txtName.Text = courtCase.caseName;
				cbActive.Checked = (courtCase.ActiveCase == "Y");

				List<int> currentTeamMembers = (from t in db.CaseTeamMembers
										 where t.CaseID == Convert.ToInt32(Request["ID"])
										 select t.CaseID).ToList<int>();
				
				foreach (ListItem li in cblTeamMembers.Items)
				{
					li.Selected = (currentTeamMembers.Contains(Convert.ToInt32(li.Value)));
				}

Initial URL

                                

Initial Description

                                

Initial Title
Check checkboxes in databound checkboxlist

Initial Tags

                                

Initial Language
C#