/// <summary> /// Views information about the assignment submission. /// </summary> /// <param name="dlistLectureNote">Data list for submission list.</param> /// <param name="assignmentId">ID of the assignment.</param> public void ViewSubmission(DataList dlistLectureNote, int assignmentId) { SubmissionList submissionList; DataTable dt = new DataTable(); submissionList = SubmissionController.GetItem(assignmentId); DataColumn dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "StudentName"; dt.Columns.Add(dc); DataColumn dc1 = new DataColumn(); dc1.DataType = Type.GetType("System.String"); dc1.ColumnName = "ATitle"; dt.Columns.Add(dc1); DataColumn dc2 = new DataColumn(); dc2.DataType = Type.GetType("System.String"); dc2.ColumnName = "SubmissionDate"; dt.Columns.Add(dc2); DataColumn dc3 = new DataColumn(); dc3.DataType = Type.GetType("System.String"); dc3.ColumnName = "Grade"; dt.Columns.Add(dc3); DataColumn dc4 = new DataColumn(); dc4.DataType = Type.GetType("System.String"); dc4.ColumnName = "StudentID"; dt.Columns.Add(dc4); DataColumn dc5 = new DataColumn(); dc5.DataType = Type.GetType("System.String"); dc5.ColumnName = "FileLocation"; dt.Columns.Add(dc5); DataRow dr; if (submissionList != null) { foreach (Submission sb in submissionList) { dr = dt.NewRow(); dr["StudentName"] = sb.Student.FullName; dr["ATitle"] = sb.Assignment.ATitle; dr["SubmissionDate"] = sb.SubmissionDate.ToShortDateString(); dr["Grade"] = sb.Grade; dr["StudentID"] = sb.Student.SId; dr["FileLocation"] = sb.FileLocation; dt.Rows.Add(dr); } } else { btnSave.Visible = false; lblNoAssignmentText.Text = "No files submitted by students."; lblNoAssignmentText.Visible = true; } dlistLectureNote.DataSource = dt; dlistLectureNote.DataBind(); }
protected override void AttachChildControls() { this.dtlstFavorite = (System.Web.UI.WebControls.DataList) this.FindControl("dtlstFavorite"); this.dtlstFavorite.RepeatDirection = this.RepeatDirection; this.dtlstFavorite.RepeatColumns = this.RepeatColumns; this.dtlstFavorite.ItemCommand += new System.Web.UI.WebControls.DataListCommandEventHandler(this.dtlstFavorite_ItemCommand); }
/// <summary> /// Views grades. /// </summary> /// <param name="dList">Data list for submission list.</param> /// <param name="sid">Student ID.</param> /// <param name="courseId">Course ID.</param> public void ViewAssignmentGradeByStudent(DataList dList, string courseId) { DataTable dt = new DataTable(); SubmissionList submissionList = SubmissionController.GetItemByCourse(courseId); DataColumn dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "StudentName"; dt.Columns.Add(dc); DataColumn dc1 = new DataColumn(); dc1.DataType = Type.GetType("System.String"); dc1.ColumnName = "AggregateGrade"; dt.Columns.Add(dc1); DataColumn dc2 = new DataColumn(); dc2.DataType = Type.GetType("System.String"); dc2.ColumnName = "StudentID"; dt.Columns.Add(dc2); DataRow dr; if (submissionList != null) { foreach (Submission sb in submissionList) { dr = dt.NewRow(); dr["StudentID"] = sb.Student.SId; dr["AggregateGrade"] = sb.Grade.ToString(".00"); dr["StudentName"] = sb.Student.FullName; dt.Rows.Add(dr); } } dList.DataSource = dt; dList.DataBind(); }
public void Can_set_RepeatDirection_Horizontal_fluently() { var dl = new DataList<string>(_datasource, Writer) .RepeatHorizontally(); Assert.AreEqual(RepeatDirection.Horizontal, dl.RepeatDirection); }
/// <summary> /// Views grades. /// </summary> /// <param name="dList">Data list for submission list.</param> /// <param name="sid">Student ID.</param> /// <param name="courseId">Course ID.</param> public void ViewAssignmentGradeByStudent(DataList dList, string sid, string courseId) { DataTable dt = new DataTable(); SubmissionList submissionList = SubmissionController.GetItem(sid,courseId); DataColumn dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "ATitle"; dt.Columns.Add(dc); DataColumn dc1 = new DataColumn(); dc1.DataType = Type.GetType("System.String"); dc1.ColumnName = "Grade"; dt.Columns.Add(dc1); DataRow dr; if (submissionList != null) { foreach (Submission sb in submissionList) { dr = dt.NewRow(); dr["ATitle"] = sb.Assignment.ATitle; dr["Grade"] = sb.Grade; dt.Rows.Add(dr); } } dList.DataSource = dt; dList.DataBind(); }
private void SetLinksForeColor(Color color, DataList dataList) { foreach (DataListItem item in dataList.Items) { HyperLink link = item.FindControl("HyperLinkMenuItem") as HyperLink; if (link != null) { link.ForeColor = color; } } }
private void Page_Load(object sender, System.EventArgs e) { HtmlForm frm = (HtmlForm)FindControl("form1"); this.GHTTestBegin(frm); DataGrid grid1 = new DataGrid(); this.GHTBuildSampleDataGrid(grid1); this.TestControls(grid1); DataList list1 = new DataList(); this.GHTBuildSampleDataList(list1); this.TestControls(list1); this.GHTTestEnd(); }
public void DataListSysModule_ItemDataBound(Object sender, DataListItemEventArgs e) { Label code = (Label)e.Item.FindControl("lbl_SysModule"); if (code != null) { System.Web.UI.WebControls.CheckBoxList cbk = (System.Web.UI.WebControls.CheckBoxList)e.Item.FindControl("Application_ID"); System.Web.UI.WebControls.DataList dl = (System.Web.UI.WebControls.DataList)e.Item.FindControl("DataListChild"); dl.DataSource = GetSysModuleMenu(code.Text.Trim()); dl.DataBind(); } }
public void DisplayCustomers(DataList dlstDataList, DropDownList ddlRegID) { _data.OpenConnection(); //Retrieve the data and display by using a Dropdown List ddlRegID.DataSource = _data.GetCustomers(); ddlRegID.DataBind(); _data.CloseReader(); //Retrieve the data and display by using a DataList dlstDataList.DataSource = _data.GetCustomers(); dlstDataList.DataBind(); _data.CloseReader(); _data.CloseConnection(); }
/// <summary> /// Views the Assignments. /// </summary> /// <param name="dlistLectureNote">Datalist to display the assignments.</param> /// <param name="courseID">ID of the course.</param> public static void ViewAssignment(DataList dlistAssignment, string courseID) { AssignmentList alist; DataTable dt = new DataTable(); alist = AssignmentController.GetItem(courseID); DataColumn dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "AFileLocation"; dt.Columns.Add(dc); DataColumn dc1 = new DataColumn(); dc1.DataType = Type.GetType("System.String"); dc1.ColumnName = "AssignmentID"; dt.Columns.Add(dc1); DataColumn dc2 = new DataColumn(); dc2.DataType = Type.GetType("System.String"); dc2.ColumnName = "AssignmentTitle"; dt.Columns.Add(dc2); DataColumn dc3 = new DataColumn(); dc3.DataType = Type.GetType("System.String"); dc3.ColumnName = "DueDate"; dt.Columns.Add(dc3); DataColumn dc4 = new DataColumn(); dc4.DataType = Type.GetType("System.String"); dc4.ColumnName = "AssignmentDate"; dt.Columns.Add(dc4); DataRow dr; if (alist != null) { foreach (Assignment assignment in alist) { dr = dt.NewRow(); dr["AFileLocation"] = assignment.AFileLocation; dr["AssignmentID"] = assignment.AssignmentId; dr["AssignmentTitle"] = assignment.ATitle; dr["DueDate"] = assignment.DueDate.ToShortDateString(); dr["AssignmentDate"] = assignment.AssignedDate; dt.Rows.Add(dr); } } dlistAssignment.DataSource = dt; dlistAssignment.DataBind(); }
void productlist_ItemDataBound(object sender, DataListItemEventArgs e) { System.Web.UI.HtmlControls.HtmlInputHidden promotionProductId = (System.Web.UI.HtmlControls.HtmlInputHidden)e.Item.FindControl("promotionProductId"); System.Web.UI.WebControls.DataList dtPresendPro = (System.Web.UI.WebControls.DataList)e.Item.FindControl("dtPresendPro"); if (shoppingCart != null) { // 赠送活动 List <ShoppingCartPresentInfo> presentList = (List <ShoppingCartPresentInfo>)shoppingCart.LinePresentPro; if (presentList != null && presentList.Count > 0) { var p = presentList.Where(m => m.PromotionProductId == (string.IsNullOrWhiteSpace(promotionProductId.Value) ? 0 : Convert.ToInt32(promotionProductId.Value))).Select(n => n); dtPresendPro.DataSource = p; dtPresendPro.DataBind(); } } }
void shoppingCartProductList_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item || e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem) { System.Web.UI.HtmlControls.HtmlInputHidden hidsupplierId = (System.Web.UI.HtmlControls.HtmlInputHidden)e.Item.FindControl("hidsupplierId"); System.Web.UI.WebControls.DataList productlist = (System.Web.UI.WebControls.DataList)e.Item.FindControl("rpProduct"); productlist.ItemCommand += productlist_ItemCommand; productlist.ItemDataBound += productlist_ItemDataBound; if (productlist != null) { if (shoppingCart != null) { List <ShoppingCartItemInfo> list = (List <ShoppingCartItemInfo>)shoppingCart.LineItems; var llist = list.Where(p => p.SupplierId == Convert.ToInt32(hidsupplierId.Value)).Select(c => c); productlist.DataSource = llist; productlist.DataBind(); } } } }
protected void btnSubmit_Click(object sender, EventArgs e) { string roleID = hf_roleID.Value; List <string> permissionCodes = new List <string>(); foreach (DataListItem item in DataListSysModule.Items) { System.Web.UI.WebControls.DataList dlChild = (DataList)item.FindControl("DataListChild"); foreach (DataListItem dl in dlChild.Items) { System.Web.UI.WebControls.CheckBoxList cbk = (CheckBoxList)dl.FindControl("Application_ID"); for (int i = 0; i < cbk.Items.Count; i++) { if (cbk.Items[i].Selected == true) { permissionCodes.Add(cbk.Items[i].Value); } } } } if (permissionCodes.Count > 0) { bool ok = BLL.Permission.AddRolePermission(roleID, permissionCodes); if (ok) { Message.Success(this, "添加成功!", "null"); } else { Message.Alert(this, "添加失败!", "null"); } } else { Message.Alert(this, "请选择菜单名称", "null"); return; } }
private void RolePermissionLoad(List <Model.Permission> list) { foreach (DataListItem item in DataListSysModule.Items) { System.Web.UI.WebControls.DataList dlChild = (DataList)item.FindControl("DataListChild"); foreach (DataListItem dl in dlChild.Items) { System.Web.UI.WebControls.CheckBoxList cbk = (CheckBoxList)dl.FindControl("Application_ID"); foreach (ListItem li in cbk.Items) { li.Selected = false; } } } DataTable dt = new DataTable(); foreach (var v in list) { foreach (var vv in v.Actions) { foreach (DataListItem item in DataListSysModule.Items) { System.Web.UI.WebControls.DataList dlChild = (DataList)item.FindControl("DataListChild"); foreach (DataListItem dl in dlChild.Items) { System.Web.UI.WebControls.CheckBoxList cbk = (CheckBoxList)dl.FindControl("Application_ID"); for (int j = 0; j < cbk.Items.Count; j++) { if (cbk.Items[j].Value == vv.PermissionCode) { cbk.Items[j].Selected = true; } } } } } } }
private void bindCourseList(DataList dlCourseList) { clist = (Session["role"].ToString() == "Student") ? CourseController.GetItem(id, true) : CourseController.GetItem(id, false); DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "CourseName"; dt.Columns.Add(dc); DataColumn dc2 = new DataColumn(); dc2.DataType = Type.GetType("System.String"); dc2.ColumnName = "InstructorName"; dt.Columns.Add(dc2); DataColumn dc3 = new DataColumn(); dc3.DataType = Type.GetType("System.String"); dc3.ColumnName = "ViewInfo"; dt.Columns.Add(dc3); DataColumn dc4 = new DataColumn(); dc4.DataType = Type.GetType("System.String"); dc4.ColumnName = "CourseID"; dt.Columns.Add(dc4); DataRow dr; foreach (Course c1 in clist) { dr = dt.NewRow(); dr["CourseName"] = c1.CName; dr["InstructorName"] = c1.Instructor.FullName; dr["ViewInfo"] = "View Course Info"; dr["CourseID"] = c1.CourseId; dt.Rows.Add(dr); } dlCourseList.DataSource = dt; dlCourseList.DataBind(); }
private void RunDesignTimeTests() { try { this.DataGrid1.DataSource = WebControl_Attributes.m_dataSource; this.DataGrid2.DataSource = WebControl_Attributes.m_dataSource; this.DataList1.DataSource = WebControl_Attributes.m_dataSource; this.DataList2.DataSource = WebControl_Attributes.m_dataSource; this.DataGrid1.DataBind(); this.DataGrid2.DataBind(); this.DataList1.DataBind(); this.DataList2.DataBind(); GHTSubTest test1 = this.GHTSubTest25; WebControl control1 = this.Button1; this.AddAttributes(ref test1, ref control1); this.Button1 = (Button) control1; this.GHTSubTest25 = test1; test1 = this.GHTSubTest26; control1 = this.CheckBox1; this.AddAttributes(ref test1, ref control1); this.CheckBox1 = (CheckBox) control1; this.GHTSubTest26 = test1; test1 = this.GHTSubTest28; control1 = this.HyperLink1; this.AddAttributes(ref test1, ref control1); this.HyperLink1 = (HyperLink) control1; this.GHTSubTest28 = test1; test1 = this.GHTSubTest30; control1 = this.Image1; this.AddAttributes(ref test1, ref control1); this.Image1 = (Image) control1; this.GHTSubTest30 = test1; test1 = this.GHTSubTest32; control1 = this.ImageButton1; this.AddAttributes(ref test1, ref control1); this.ImageButton1 = (ImageButton) control1; this.GHTSubTest32 = test1; test1 = this.GHTSubTest34; control1 = this.Label1; this.AddAttributes(ref test1, ref control1); this.Label1 = (Label) control1; this.GHTSubTest34 = test1; test1 = this.GHTSubTest36; control1 = this.LinkButton1; this.AddAttributes(ref test1, ref control1); this.LinkButton1 = (LinkButton) control1; this.GHTSubTest36 = test1; test1 = this.GHTSubTest37; control1 = this.Panel1; this.AddAttributes(ref test1, ref control1); this.Panel1 = (Panel) control1; this.GHTSubTest37 = test1; test1 = this.GHTSubTest38; control1 = this.RadioButton1; this.AddAttributes(ref test1, ref control1); this.RadioButton1 = (RadioButton) control1; this.GHTSubTest38 = test1; test1 = this.GHTSubTest39; control1 = this.TextBox1; this.AddAttributes(ref test1, ref control1); this.TextBox1 = (TextBox) control1; this.GHTSubTest39 = test1; test1 = this.GHTSubTest40; control1 = this.DropDownList1; this.AddAttributes(ref test1, ref control1); this.DropDownList1 = (DropDownList) control1; this.GHTSubTest40 = test1; test1 = this.GHTSubTest41; control1 = this.ListBox1; this.AddAttributes(ref test1, ref control1); this.ListBox1 = (ListBox) control1; this.GHTSubTest41 = test1; test1 = this.GHTSubTest42; control1 = this.RadioButtonList1; this.AddAttributes(ref test1, ref control1); this.RadioButtonList1 = (RadioButtonList) control1; this.GHTSubTest42 = test1; test1 = this.GHTSubTest43; control1 = this.CheckBoxList1; this.AddAttributes(ref test1, ref control1); this.CheckBoxList1 = (CheckBoxList) control1; this.GHTSubTest43 = test1; test1 = this.GHTSubTest50; control1 = this.DataGrid1; this.AddAttributes(ref test1, ref control1); this.DataGrid1 = (DataGrid) control1; this.GHTSubTest50 = test1; test1 = this.GHTSubTest51; control1 = this.DataGrid2.Items[0]; this.AddAttributes(ref test1, ref control1); this.GHTSubTest51 = test1; test1 = this.GHTSubTest52; control1 = this.DataList1; this.AddAttributes(ref test1, ref control1); this.DataList1 = (DataList) control1; this.GHTSubTest52 = test1; test1 = this.GHTSubTest53; control1 = this.DataList2.Items[0]; this.AddAttributes(ref test1, ref control1); this.GHTSubTest53 = test1; test1 = this.GHTSubTest54; control1 = this.Table1; this.AddAttributes(ref test1, ref control1); this.Table1 = (Table) control1; this.GHTSubTest54 = test1; test1 = this.GHTSubTest55; control1 = this.Table5; this.AddAttributes(ref test1, ref control1); this.Table5 = (Table) control1; this.GHTSubTest55 = test1; test1 = this.GHTSubTest56; control1 = this.Table2; this.AddAttributes(ref test1, ref control1); this.Table2 = (Table) control1; this.GHTSubTest56 = test1; test1 = this.GHTSubTest57; control1 = this.Table3; this.AddAttributes(ref test1, ref control1); this.Table3 = (Table) control1; this.GHTSubTest57 = test1; } catch (Exception exception2) { // ProjectData.SetProjectError(exception2); Exception exception1 = exception2; this.GHTSubTestBegin(); string text1 = string.Empty + exception1.GetType().ToString(); text1 = text1 + " caught during preperations for design time tests."; text1 = text1 + "<br>Message: "; text1 = text1 + exception1.Message; text1 = text1 + "<br>Trace: "; text1 = text1 + exception1.StackTrace; this.GHTSubTestAddResult(text1); this.GHTSubTestEnd(); // ProjectData.ClearProjectError(); } }
public void ByDefault_RepeatDirection_is_Vertical() { var dl = new DataList<string>(_datasource, Writer); Assert.AreEqual(RepeatDirection.Vertical, dl.RepeatDirection); }
public void When_calling_AmoutOfColumnsIs_amount_should_set_RepeatColumns() { var dl = new DataList<string>(_datasource, Writer) .NumberOfColumns(5); Assert.AreEqual(5, dl.RepeatColumns); }
public void InstantiateIn(Control container) { Control sideBarListControl = null; if (_owner.SideBarList == null) { var dataList = new DataList(); dataList.ID = Wizard.DataListID; dataList.SelectedItemStyle.Font.Bold = true; dataList.ItemTemplate = _owner.CreateDefaultDataListItemTemplate(); sideBarListControl = dataList; } else { sideBarListControl = (Control)_owner.SideBarList; } container.Controls.Add(sideBarListControl); }
void PlaceIt(ref double LeftUnits, ref double RightUnits, Panel Content, DataList ItemsDataList, double ItemSize, int MaxCount) { if (LeftUnits > RightUnits) { //put it on the right ContentPanel.Controls.Remove(Content); RightPh.Controls.Add(Content); if (ItemsDataList.Items.Count > 0) { RightUnits += 1.0; //RightUnits += ItemsDataList.Items.Count * ItemSize; //items //RightUnits += 0.5; //header //if (ItemsDataList.Items.Count == MaxCount) // RightUnits += 0.5; //footer //else // RightUnits += 0.25; //no footer } } else { //put it on the left //put it on the right ContentPanel.Controls.Remove(Content); LeftPh.Controls.Add(Content); if (ItemsDataList.Items.Count > 0) { LeftUnits += 1.0; //LeftUnits += ItemsDataList.Items.Count * ItemSize; //items //LeftUnits += 0.5; //header //if (ItemsDataList.Items.Count == MaxCount) // LeftUnits += 0.5; //footer //else // LeftUnits += 0.25; //no footer } } }
/// <include file='doc\DataListGeneralPage.uex' path='docs/doc[@for="DataListGeneralPage.LoadComponent"]/*' /> /// <devdoc> /// Loads the component into the page. /// </devdoc> protected override void LoadComponent() { InitPage(); DataList dataList = (DataList)GetBaseControl(); LoadDataSourceItems(); showHeaderCheck.Checked = dataList.ShowHeader; showFooterCheck.Checked = dataList.ShowFooter; repeatColumnsEdit.Text = (dataList.RepeatColumns).ToString(); switch (dataList.RepeatDirection) { case RepeatDirection.Horizontal: repeatDirectionCombo.SelectedIndex = IDX_DIR_HORIZONTAL; break; case RepeatDirection.Vertical: repeatDirectionCombo.SelectedIndex = IDX_DIR_VERTICAL; break; } switch (dataList.RepeatLayout) { case RepeatLayout.Table: repeatLayoutCombo.SelectedIndex = IDX_MODE_TABLE; break; case RepeatLayout.Flow: repeatLayoutCombo.SelectedIndex = IDX_MODE_FLOW; break; } extractRowsCheck.Checked = dataList.ExtractTemplateRows; if (dataSourceCombo.Items.Count > 0) { DataListDesigner dataListDesigner = (DataListDesigner)GetBaseDesigner(); string dataSourceValue = dataListDesigner.DataSource; if (dataSourceValue != null) { int dataSourcesAvailable = dataSourceCombo.Items.Count; for (int j = 1; j < dataSourcesAvailable; j++) { DataSourceItem dataSourceItem = (DataSourceItem)dataSourceCombo.Items[j]; if (String.Compare(dataSourceItem.Name, dataSourceValue, true, CultureInfo.InvariantCulture) == 0) { dataSourceCombo.SelectedIndex = j; currentDataSource = dataSourceItem; LoadDataMembers(); if (currentDataSource is ListSourceDataSourceItem) { string dataMember = dataListDesigner.DataMember; dataMemberCombo.SelectedIndex = dataMemberCombo.FindStringExact(dataMember); if (dataMemberCombo.IsSet()) { ((ListSourceDataSourceItem)currentDataSource).CurrentDataMember = dataMember; } } LoadDataSourceFields(); break; } } } } string dataKeyField = dataList.DataKeyField; if (dataKeyField.Length != 0) { int fieldIndex = dataKeyFieldCombo.FindStringExact(dataKeyField); dataKeyFieldCombo.SelectedIndex = fieldIndex; } UpdateEnabledVisibleState(); }
void CreateSideBar (Control container) { WebControl wctl = container as WebControl; if (wctl != null) RegisterApplyStyle (wctl, SideBarStyle); if (sideBarTemplate != null) { sideBarTemplate.InstantiateIn (container); stepDatalist = container.FindControl (DataListID) as DataList; if (stepDatalist == null) throw new InvalidOperationException ("The side bar template must contain a DataList control with id '" + DataListID + "'."); stepDatalist.ItemDataBound += new DataListItemEventHandler(StepDatalistItemDataBound); } else { stepDatalist = new DataList (); stepDatalist.ID = DataListID; stepDatalist.SelectedItemStyle.Font.Bold = true; stepDatalist.ItemTemplate = SideBarItemTemplate; container.Controls.Add (stepDatalist); } stepDatalist.ItemCommand += new DataListCommandEventHandler (StepDatalistItemCommand); stepDatalist.CellSpacing = 0; stepDatalist.DataSource = WizardSteps; stepDatalist.SelectedIndex = ActiveStepIndex; stepDatalist.DataBind (); }
void CreateSideBar (TableCell sideBarCell) { RegisterApplyStyle (sideBarCell, SideBarStyle); if (SkipLinkText != "") { System.Web.UI.HtmlControls.HtmlAnchor anchor = new System.Web.UI.HtmlControls.HtmlAnchor (); anchor.HRef = "#" + ClientID + "_SkipLink"; Image img = new Image (); ClientScriptManager csm = new ClientScriptManager (null); img.ImageUrl = csm.GetWebResourceUrl (typeof (SiteMapPath), "transparent.gif"); img.Attributes.Add ("height", "0"); img.Attributes.Add ("width", "0"); img.AlternateText = SkipLinkText; anchor.Controls.Add (img); sideBarCell.Controls.Add (anchor); } if (sideBarTemplate != null) { sideBarTemplate.InstantiateIn (sideBarCell); stepDatalist = sideBarCell.FindControl (DataListID) as DataList; if (stepDatalist == null) throw new InvalidOperationException ("The side bar template must contain a DataList control with id '" + DataListID + "'."); stepDatalist.ItemDataBound += new DataListItemEventHandler(StepDatalistItemDataBound); } else { stepDatalist = new DataList (); stepDatalist.ID = DataListID; stepDatalist.SelectedItemStyle.Font.Bold = true; stepDatalist.ItemTemplate = SideBarItemTemplate; sideBarCell.Controls.Add (stepDatalist); } if (SkipLinkText != "") { System.Web.UI.HtmlControls.HtmlAnchor anchor = new System.Web.UI.HtmlControls.HtmlAnchor (); anchor.ID = "SkipLink"; sideBarCell.Controls.Add (anchor); } stepDatalist.ItemCommand += new DataListCommandEventHandler (StepDatalistItemCommand); stepDatalist.CellSpacing = 0; stepDatalist.DataSource = WizardSteps; stepDatalist.SelectedIndex = ActiveStepIndex; stepDatalist.DataBind (); }
public void XPath () { Page page = new Page (); XmlDataSource ds = new XmlDataSource (); ds.ID = "ds"; ds.Data = @"<?xml version=""1.0"" encoding=""utf-8""?> <bookstore xmlns:bk=""urn:samples""> <book genre=""novel"" publicationdate=""1999"" bk:ISBN=""0192100262""> <title>Pride and Prejudice</title> <author> <first-name>Jane</first-name> <last-name>Austen</last-name> </author> <price>24.95</price>"" </book> <book genre=""novel"" publicationdate=""1985"" bk:ISBN=""0771008139""> <title>The Handmaid's Tale</title> <author> <first-name>Margaret</first-name> <last-name>Atwood</last-name> </author> <price>29.95</price> </book> </bookstore>"; DataList list0 = new DataList (); DataList list1 = new DataList (); DataList list2 = new DataList (); page.Controls.Add (list0); page.Controls.Add (list1); page.Controls.Add (list2); page.Controls.Add (ds); list0.DataSourceID = "ds"; list0.DataBind (); Assert.AreEqual (2, list0.Items.Count, "Before XPath elements"); ds.XPath = "/bookstore/book [title='Pride and Prejudice']"; list1.DataSourceID = "ds"; list1.DataBind (); Assert.AreEqual (1, list1.Items.Count, "After XPath elements"); ds.XPath = "bookstore/book [@genre='novel']"; list2.DataSourceID = "ds"; list2.DataBind (); Assert.AreEqual (2, list2.Items.Count, "After XPath property"); }
protected override void AttachChildControls() { this.dataListPointDetails = (System.Web.UI.WebControls.DataList) this.FindControl("dataListPointDetails"); this.dataListPointDetails.ItemDataBound += new System.Web.UI.WebControls.DataListItemEventHandler(this.dataListPointDetails_ItemDataBound); }
public void InstantiateIn(Control container) { DataList dataList = new DataList(); dataList.ID = Wizard.DataListID; container.Controls.Add(dataList); dataList.SelectedItemStyle.Font.Bold = true; dataList.ItemTemplate = new DataListItemTemplate(); }
protected override void AttachChildControls() { this.dataListAccountDetails = (System.Web.UI.WebControls.DataList) this.FindControl("dataListAccountDetails"); }
protected override void AttachChildControls() { this.dataListOrderItems = (System.Web.UI.WebControls.DataList) this.FindControl("dataListOrderItems"); }
private void RunDesignTimeTests() { try { this.DataGrid1.DataSource = WebControl_Attributes.m_dataSource; this.DataGrid2.DataSource = WebControl_Attributes.m_dataSource; this.DataList1.DataSource = WebControl_Attributes.m_dataSource; this.DataList2.DataSource = WebControl_Attributes.m_dataSource; this.DataGrid1.DataBind(); this.DataGrid2.DataBind(); this.DataList1.DataBind(); this.DataList2.DataBind(); GHTSubTest test1 = this.GHTSubTest25; WebControl control1 = this.Button1; this.AddAttributes(ref test1, ref control1); this.Button1 = (Button)control1; this.GHTSubTest25 = test1; test1 = this.GHTSubTest26; control1 = this.CheckBox1; this.AddAttributes(ref test1, ref control1); this.CheckBox1 = (CheckBox)control1; this.GHTSubTest26 = test1; test1 = this.GHTSubTest28; control1 = this.HyperLink1; this.AddAttributes(ref test1, ref control1); this.HyperLink1 = (HyperLink)control1; this.GHTSubTest28 = test1; test1 = this.GHTSubTest30; control1 = this.Image1; this.AddAttributes(ref test1, ref control1); this.Image1 = (Image)control1; this.GHTSubTest30 = test1; test1 = this.GHTSubTest32; control1 = this.ImageButton1; this.AddAttributes(ref test1, ref control1); this.ImageButton1 = (ImageButton)control1; this.GHTSubTest32 = test1; test1 = this.GHTSubTest34; control1 = this.Label1; this.AddAttributes(ref test1, ref control1); this.Label1 = (Label)control1; this.GHTSubTest34 = test1; test1 = this.GHTSubTest36; control1 = this.LinkButton1; this.AddAttributes(ref test1, ref control1); this.LinkButton1 = (LinkButton)control1; this.GHTSubTest36 = test1; test1 = this.GHTSubTest37; control1 = this.Panel1; this.AddAttributes(ref test1, ref control1); this.Panel1 = (Panel)control1; this.GHTSubTest37 = test1; test1 = this.GHTSubTest38; control1 = this.RadioButton1; this.AddAttributes(ref test1, ref control1); this.RadioButton1 = (RadioButton)control1; this.GHTSubTest38 = test1; test1 = this.GHTSubTest39; control1 = this.TextBox1; this.AddAttributes(ref test1, ref control1); this.TextBox1 = (TextBox)control1; this.GHTSubTest39 = test1; test1 = this.GHTSubTest40; control1 = this.DropDownList1; this.AddAttributes(ref test1, ref control1); this.DropDownList1 = (DropDownList)control1; this.GHTSubTest40 = test1; test1 = this.GHTSubTest41; control1 = this.ListBox1; this.AddAttributes(ref test1, ref control1); this.ListBox1 = (ListBox)control1; this.GHTSubTest41 = test1; test1 = this.GHTSubTest42; control1 = this.RadioButtonList1; this.AddAttributes(ref test1, ref control1); this.RadioButtonList1 = (RadioButtonList)control1; this.GHTSubTest42 = test1; test1 = this.GHTSubTest43; control1 = this.CheckBoxList1; this.AddAttributes(ref test1, ref control1); this.CheckBoxList1 = (CheckBoxList)control1; this.GHTSubTest43 = test1; test1 = this.GHTSubTest50; control1 = this.DataGrid1; this.AddAttributes(ref test1, ref control1); this.DataGrid1 = (DataGrid)control1; this.GHTSubTest50 = test1; test1 = this.GHTSubTest51; control1 = this.DataGrid2.Items[0]; this.AddAttributes(ref test1, ref control1); this.GHTSubTest51 = test1; test1 = this.GHTSubTest52; control1 = this.DataList1; this.AddAttributes(ref test1, ref control1); this.DataList1 = (DataList)control1; this.GHTSubTest52 = test1; test1 = this.GHTSubTest53; control1 = this.DataList2.Items[0]; this.AddAttributes(ref test1, ref control1); this.GHTSubTest53 = test1; test1 = this.GHTSubTest54; control1 = this.Table1; this.AddAttributes(ref test1, ref control1); this.Table1 = (Table)control1; this.GHTSubTest54 = test1; test1 = this.GHTSubTest55; control1 = this.Table5; this.AddAttributes(ref test1, ref control1); this.Table5 = (Table)control1; this.GHTSubTest55 = test1; test1 = this.GHTSubTest56; control1 = this.Table2; this.AddAttributes(ref test1, ref control1); this.Table2 = (Table)control1; this.GHTSubTest56 = test1; test1 = this.GHTSubTest57; control1 = this.Table3; this.AddAttributes(ref test1, ref control1); this.Table3 = (Table)control1; this.GHTSubTest57 = test1; } catch (Exception exception2) { // ProjectData.SetProjectError(exception2); Exception exception1 = exception2; this.GHTSubTestBegin(); string text1 = string.Empty + exception1.GetType().ToString(); text1 = text1 + " caught during preperations for design time tests."; text1 = text1 + "<br>Message: "; text1 = text1 + exception1.Message; text1 = text1 + "<br>Trace: "; text1 = text1 + exception1.StackTrace; this.GHTSubTestAddResult(text1); this.GHTSubTestEnd(); // ProjectData.ClearProjectError(); } }
protected override void AttachChildControls() { this.dataListShoppingCrat = (DataList) this.FindControl("dataListShoppingCrat"); this.pnlShopGiftCart = (Panel) this.FindControl("pnlShopGiftCart"); this.pnlShopGiftCart.Visible = false; }
private void RunDesignTimeTests() { try { this.Datagrid3.DataSource = WebControl_Style.m_dataSource; this.Datagrid4.DataSource = WebControl_Style.m_dataSource; this.Datalist3.DataSource = WebControl_Style.m_dataSource; this.Datalist4.DataSource = WebControl_Style.m_dataSource; this.Datagrid3.DataBind(); this.Datagrid4.DataBind(); this.Datalist3.DataBind(); this.Datalist4.DataBind(); GHTSubTest test1 = this.GHTSubTest24; WebControl control1 = this.Button2; this.AddAttributes(ref test1, ref control1); this.Button2 = (Button)control1; this.GHTSubTest24 = test1; test1 = this.GHTSubTest25; control1 = this.Checkbox2; this.AddAttributes(ref test1, ref control1); this.Checkbox2 = (CheckBox)control1; this.GHTSubTest25 = test1; test1 = this.GHTSubTest26; control1 = this.Hyperlink2; this.AddAttributes(ref test1, ref control1); this.Hyperlink2 = (HyperLink)control1; this.GHTSubTest26 = test1; test1 = this.GHTSubTest27; control1 = this.Image2; this.AddAttributes(ref test1, ref control1); this.Image2 = (Image)control1; this.GHTSubTest27 = test1; test1 = this.GHTSubTest28; control1 = this.Imagebutton2; this.AddAttributes(ref test1, ref control1); this.Imagebutton2 = (ImageButton)control1; this.GHTSubTest28 = test1; test1 = this.GHTSubTest29; control1 = this.Label2; this.AddAttributes(ref test1, ref control1); this.Label2 = (Label)control1; this.GHTSubTest29 = test1; test1 = this.GHTSubTest30; control1 = this.Linkbutton2; this.AddAttributes(ref test1, ref control1); this.Linkbutton2 = (LinkButton)control1; this.GHTSubTest30 = test1; test1 = this.GHTSubTest31; control1 = this.Panel2; this.AddAttributes(ref test1, ref control1); this.Panel2 = (Panel)control1; this.GHTSubTest31 = test1; test1 = this.GHTSubTest32; control1 = this.Radiobutton2; this.AddAttributes(ref test1, ref control1); this.Radiobutton2 = (RadioButton)control1; this.GHTSubTest32 = test1; test1 = this.GHTSubTest33; control1 = this.Textbox2; this.AddAttributes(ref test1, ref control1); this.Textbox2 = (TextBox)control1; this.GHTSubTest33 = test1; test1 = this.GHTSubTest34; control1 = this.Dropdownlist2; this.AddAttributes(ref test1, ref control1); this.Dropdownlist2 = (DropDownList)control1; this.GHTSubTest34 = test1; test1 = this.GHTSubTest35; control1 = this.Listbox2; this.AddAttributes(ref test1, ref control1); this.Listbox2 = (ListBox)control1; this.GHTSubTest35 = test1; test1 = this.GHTSubTest36; control1 = this.Radiobuttonlist2; this.AddAttributes(ref test1, ref control1); this.Radiobuttonlist2 = (RadioButtonList)control1; this.GHTSubTest36 = test1; test1 = this.GHTSubTest37; control1 = this.Checkboxlist2; this.AddAttributes(ref test1, ref control1); this.Checkboxlist2 = (CheckBoxList)control1; this.GHTSubTest37 = test1; test1 = this.GHTSubTest44; control1 = this.Datagrid3; this.AddAttributes(ref test1, ref control1); this.Datagrid3 = (DataGrid)control1; this.GHTSubTest44 = test1; test1 = this.GHTSubTest45; control1 = this.Datagrid4.Items[0]; this.AddAttributes(ref test1, ref control1); this.GHTSubTest45 = test1; test1 = this.GHTSubTest46; control1 = this.Datalist3; this.AddAttributes(ref test1, ref control1); this.Datalist3 = (DataList)control1; this.GHTSubTest46 = test1; test1 = this.GHTSubTest47; control1 = this.Datalist4.Items[0]; this.AddAttributes(ref test1, ref control1); this.GHTSubTest47 = test1; test1 = this.GHTSubTest48; control1 = this.Table4; this.AddAttributes(ref test1, ref control1); this.Table4 = (Table)control1; this.GHTSubTest48 = test1; test1 = this.GHTSubTest49; control1 = this.Table6; this.AddAttributes(ref test1, ref control1); this.Table6 = (Table)control1; this.GHTSubTest49 = test1; test1 = this.GHTSubTest50; control1 = this.Table7; this.AddAttributes(ref test1, ref control1); this.Table7 = (Table)control1; this.GHTSubTest50 = test1; test1 = this.GHTSubTest51; control1 = this.Table8; this.AddAttributes(ref test1, ref control1); this.Table8 = (Table)control1; this.GHTSubTest51 = test1; } catch (Exception exception2) { // ProjectData.SetProjectError(exception2); Exception exception1 = exception2; this.GHTSubTestBegin(); this.GHTSubTestUnexpectedExceptionCaught(exception1); this.GHTSubTestEnd(); // ProjectData.ClearProjectError(); } }
//Load XML File to DataList public void LoadXml2DataList(DataList datalist, string xmlPath) { string strXmlPath = HttpContext.Current.Server.MapPath(xmlPath); try { DataSet ds = new DataSet(); ds.ReadXml(strXmlPath); datalist.DataSource = ds; datalist.DataBind(); } catch (Exception ex) { ex.ToString(); } }
private void LoadAccountCategoryList(DataList lstAccountCategory, int AccountSummaryID) { AccountCategories clsAccountCategory = new AccountCategories(); DataClass clsDataClass = new DataClass(); System.Data.DataTable dt = clsDataClass.DataReaderToDataTable(clsAccountCategory.List(AccountSummaryID, "AccountCategoryCode", SortOption.Ascending)); clsAccountCategory.CommitAndDispose(); lstAccountCategory.DataSource = dt.DefaultView; lstAccountCategory.DataBind(); }
/// <include file='doc\DataListGeneralPage.uex' path='docs/doc[@for="DataListGeneralPage.SaveComponent"]/*' /> /// <devdoc> /// Saves the component loaded into the page. /// </devdoc> protected override void SaveComponent() { DataList dataList = (DataList)GetBaseControl(); dataList.ShowHeader = showHeaderCheck.Checked; dataList.ShowFooter = showFooterCheck.Checked; try { int repeatColumns = 1; string repeatColumnsValue = repeatColumnsEdit.Text.Trim(); if (repeatColumnsValue.Length != 0) { repeatColumns = Int32.Parse(repeatColumnsValue, CultureInfo.InvariantCulture); } dataList.RepeatColumns = repeatColumns; } catch (Exception) { repeatColumnsEdit.Text = (dataList.RepeatColumns).ToString(); } switch (repeatDirectionCombo.SelectedIndex) { case IDX_DIR_HORIZONTAL: dataList.RepeatDirection = RepeatDirection.Horizontal; break; case IDX_DIR_VERTICAL: dataList.RepeatDirection = RepeatDirection.Vertical; break; } switch (repeatLayoutCombo.SelectedIndex) { case IDX_MODE_TABLE: dataList.RepeatLayout = RepeatLayout.Table; break; case IDX_MODE_FLOW: dataList.RepeatLayout = RepeatLayout.Flow; break; } dataList.ExtractTemplateRows = extractRowsCheck.Checked; string dataKeyField = String.Empty; if (dataKeyFieldCombo.IsSet()) { dataKeyField = (string)dataKeyFieldCombo.SelectedItem; } dataList.DataKeyField = dataKeyField; if (dataSourceDirty) { DataListDesigner dataListDesigner = (DataListDesigner)GetBaseDesigner(); // save the datasource as a binding on the control DataBindingCollection dataBindings = dataListDesigner.DataBindings; if (currentDataSource == null) { dataListDesigner.DataSource = String.Empty; dataListDesigner.DataMember = String.Empty; } else { dataListDesigner.DataSource = currentDataSource.ToString(); if (dataMemberCombo.IsSet()) { dataListDesigner.DataMember = (string)dataMemberCombo.SelectedItem; } else { dataListDesigner.DataMember = String.Empty; } } dataListDesigner.OnDataSourceChanged(); } }
private void LoadChartOfAccountList(DataList lstChartOfAccount, int AccountCategoryID) { ChartOfAccounts clsChartOfAccount = new ChartOfAccounts(); DataClass clsDataClass = new DataClass(); System.Data.DataTable dt = clsDataClass.DataReaderToDataTable(clsChartOfAccount.List(AccountCategoryID, "ChartOfAccountCode", SortOption.Ascending)); clsChartOfAccount.CommitAndDispose(); lstChartOfAccount.DataSource = dt.DefaultView; lstChartOfAccount.DataBind(); }
protected override void AttachChildControls() { this.dataListCoupon = (DataList) this.FindControl("dataListCoupon"); this.dataListCoupon.ItemCommand += new DataListCommandEventHandler(this.dataListCoupon_ItemCommand); }
public void InstantiateIn(Control container) { DataList child = new DataList { ID = Wizard.DataListID }; container.Controls.Add(child); child.SelectedItemStyle.Font.Bold = true; child.ItemTemplate = new CreateUserWizard.DataListItemTemplate(); }
protected override void AttachChildControls() { this.dataListPointDetails = (DataList) this.FindControl("dataListPointDetails"); }
protected override void AttachChildControls() { this.dtlstRegionsSelect = (DataList) this.FindControl("dtlstRegionsSelect"); this.dtlstRegionsSelect.ItemCommand += new DataListCommandEventHandler(this.dtlstRegionsSelect_ItemCommand); }
public void ByDefault_RepeatColumns_is_0() { var dl = new DataList<string>(_datasource, Writer); Assert.AreEqual(0, dl.RepeatColumns); }
protected override void InitializeSkin(System.Web.UI.Control Skin) { DataList1 = (DataList)Skin.FindControl("DataList1"); DataBind(); //throw new NotImplementedException(); }
protected override void AttachChildControls() { this.dataListCoupon = (System.Web.UI.WebControls.DataList) this.FindControl("dataListCoupon"); }
public override string GetDesignTimeHtml(DesignerRegionCollection regions) { string content = String.Empty; regions.Add(BuildRegion()); StringBuilder sb = new StringBuilder(1024); if (CurrentTemplate == null) { sb.Append(String.Format(CultureInfo.InvariantCulture, _designtimeHTML, ColorTranslator.ToHtml(SystemColors.ControlText), ColorTranslator.ToHtml(SystemColors.Control), ReorderList.ID, DesignerRegion.DesignerRegionAttributeName, content)); } else { DataList dl = new DataList(); sb.Append(String.Format(CultureInfo.InvariantCulture, _designtimeHTML_Template, CurrentViewName, dl.HeaderStyle, ReorderList.ControlStyle, DesignerRegion.DesignerRegionAttributeName, content, ColorTranslator.ToHtml(SystemColors.ControlText), ColorTranslator.ToHtml(SystemColors.Control), ReorderList.ID, ReorderList.GetType().Name)); dl.Dispose(); } return sb.ToString(); }
private static void _SideBarTemplate (Control container) { DataList list = new DataList (); list.ItemTemplate = new CompiledTemplateBuilder (_ItemTemplate); list.ID = "SideBarList"; container.Controls.Add (list); }
/// <summary> /// 邦定DataList /// </summary> /// <param name="DataScore">数据源</param> /// <param name="DL">DataList控件</param> public virtual void BindDataList(object DataScore, System.Web.UI.WebControls.DataList DL) { DL.DataSource = DataScore; DL.DataBind(); DL.Dispose(); }
protected override void AttachChildControls() { this.dataListCoupon = (System.Web.UI.WebControls.DataList) this.FindControl("dataListCoupon"); this.dataListCoupon.ItemCommand += new System.Web.UI.WebControls.DataListCommandEventHandler(this.dataListCoupon_ItemCommand); }
protected override void AttachChildControls() { this.dtlstRegionsSelect = (System.Web.UI.WebControls.DataList) this.FindControl("dtlstRegionsSelect"); this.dtlstRegionsSelect.ItemCommand += new System.Web.UI.WebControls.DataListCommandEventHandler(this.dtlstRegionsSelect_ItemCommand); }