// devsolution 2003/6/17: Finished - Added items for calendar control /// <summary> /// devsolution 2003/6/17: /// Change to make a RenderEvents for modularity /// Routine to add show calendar logic /// And Clean up code as now the calendar next and previous /// controls must re-render the display and get the data again /// e.g. modularize the code /// </summary> /// <param name="DisplayMonth">Month to display 1=Jan, 2=Feb, etc</param> /// <param name="DisplayYear">Year to display YYYY, 2003 for 2003</param> private void RenderEvents(int DisplayMonth, int DisplayYear) { EventsDB events = new EventsDB(); myDataList.RepeatDirection = (Settings["RepeatDirectionSetting"].ToString() == "Horizontal" ? RepeatDirection.Horizontal : RepeatDirection.Vertical); myDataList.RepeatColumns = Int32.Parse(Settings["RepeatColumns"].ToString()); if (bool.Parse(Settings["ShowBorder"].ToString())) { //myDataList.BorderWidth=Unit.Pixel(1); myDataList.ItemStyle.BorderWidth = Unit.Pixel(1); } dsEventData = events.GetEvents(ModuleID, Version); myDataList.DataSource = dsEventData; myDataList.DataBind(); // devsolution 2003/6/17: Added items for calendar control if (bool.Parse(Settings["ShowCalendar"].ToString())) { CalendarPanel.Visible = true; string DisplayDate = string.Empty; // devsolution 2003/6/17: Must have Devsolution.Portal.dll in \bin for calendar display functionality DevSolution.Portal.EventCalendar eventcalendar = new DevSolution.Portal.EventCalendar(); lblCalendar.Text = eventcalendar.GenerateCalendar(ModuleID, DisplayMonth, DisplayYear, out DisplayDate, dsEventData); lblDisplayDate.Text = DisplayDate; } // devsolution 2003/6/17: Finished - Added items for calendar control myDataList.DataSource = dsEventData; myDataList.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here oleDbConnection1.Open(); ds = new DataSet(); daAttendees = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM Attendees", oleDbConnection1); daRooms = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM Rooms", oleDbConnection1); daEvents = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM Events", oleDbConnection1); daAttendees.Fill(ds, "Attendees"); daRooms.Fill(ds, "Rooms"); daEvents.Fill(ds, "Events"); attendeeList.DataSource = ds.Tables["Attendees"]; roomList.DataSource = ds.Tables["Rooms"]; eventTable = ds.Tables["Events"]; eventDetails1.DataSource = eventTable; eventDetails2.DataSource = eventTable; if (!this.IsPostBack) { System.DateTime trialDate = System.DateTime.Now; calendar.SelectedDate = getFreeDate(trialDate); this.DataBind(); } else { eventDetails1.DataBind(); eventDetails2.DataBind(); } oleDbConnection1.Close(); }
private void Page_Load(object sender, System.EventArgs e) { HtmlForm frm = (HtmlForm)FindControl("Form1"); GHTTestBegin(frm); GHTActiveSubTest = GHTSubTest1; try { DataList1.DataSource = m_data;; DataList1.DataBind(); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTActiveSubTest = GHTSubTest2; try { DataList2.DataSource = m_data; DataList2.DataBind(); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTActiveSubTest = GHTSubTest3; try { DataList3.DataSource = m_data; DataList3.DataBind(); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTActiveSubTest = GHTSubTest4; try { DataList1.DataSource = m_data;; DataList1.DataBind();; DataList1.EditItemIndex = -2; GHTSubTestExpectedExceptionNotCaught("ArgumentException"); } catch (ArgumentException ex) { GHTSubTestExpectedExceptionCaught(ex); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTTestEnd(); }
private void BindData() { CDalAddress oDb = new CDalAddress(); oDb.strConnection = ConfigurationSettings.AppSettings["appStrConnection"]; dlAddress.DataSource = oDb.getAll(); dlAddress.DataBind(); oDb = null; }
private void BindPlaces() { adPlaces.Fill(dsPlaces); if (dsPlaces.Place.Rows.Count == 0) { dlPlaces.Visible = false; } else { dlPlaces.DataBind(); } }
/// <summary> /// The Page_Load event handler on this User Control is used to /// obtain a DataSet of announcement information from the Announcements /// table, and then databind the results to a templated DataList /// server control. It uses the Rainbow.AnnouncementsDB() /// data component to encapsulate all data functionality. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Page_Load(object sender, System.EventArgs e) { if (Page.IsPostBack == false) { //myDataList appearance if (bool.Parse(Settings["ShowBorder"].ToString())) { myDataList.ItemStyle.BorderWidth = Unit.Pixel(1); } myDataList.RepeatDirection = (Settings["RepeatDirectionSetting"].ToString() == "Horizontal" ? RepeatDirection.Horizontal : RepeatDirection.Vertical); myDataList.RepeatColumns = Int32.Parse(Settings["RepeatColumns"].ToString()); //myDataList content string sortField = Settings["SortField"].ToString(); string sortDirection = Settings["SortDirection"].ToString(); // Obtain announcement information from Announcements table // and bind to the datalist control AnnouncementsDB announcements = new AnnouncementsDB(); DataSet announces = announcements.GetAnnouncements(ModuleID, Version); DataView myDataView = new DataView(); myDataView = announces.Tables[0].DefaultView; myDataView.Sort = sortField + " " + sortDirection; myDataList.DataSource = myDataView; myDataList.DataBind(); } }
private void BindNiveleUtilizator() { Salaries.Business.NivelUtilizator niv = new Salaries.Business.NivelUtilizator(); niv.AngajatorId = Int32.Parse(Session["AngajatorID"].ToString()); listaNivele.DataSource = niv.LoadNivelePentruUtilizator(idUtilizator); listaNivele.DataBind(); }
private void GetRefList(int refID) { QnaBiz objBoard = new QnaBiz(db); BoardList.DataSource = objBoard.GetRefList(refID); BoardList.DataBind(); }
/// <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(); }
private void BindTypeList() { UDS.Components.MyLinkman mylinkman = new UDS.Components.MyLinkman(); dlt_Type.DataSource = mylinkman.GetCustomLinkmanType(); dlt_Type.DataKeyField = "ID"; dlt_Type.DataBind(); }
private void BindNiveleAngajat() { Salaries.Business.NivelAngajat niv = new Salaries.Business.NivelAngajat(); niv.AngajatorId = Int32.Parse(Session["AngajatorID"].ToString()); listaNivele.DataSource = niv.LoadNivelePentruAngajat(AngajatID); listaNivele.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { string Where = "where Condition='" + FormulaName + "'"; if (Exchange != "") { Where += " and exchange='" + Exchange + "'"; } DataTable dtCond = DB.GetDataTable("select * from Condition " + Where + " order by ConditionId desc"); string s = ""; foreach (DataRow dr in dtCond.Rows) { DateTime NowStartTime = (DateTime)dr["StartTime"]; if (LastStartTime != DateTime.MinValue && NowStartTime != LastStartTime) { break; } if (s != "") { s += ","; } s += dr["ConditionId"].ToString(); LastStartTime = (DateTime)dr["StartTime"]; } if (s != "") { DataTable dt = DB.GetDataTable("select distinct QuoteCode from ScanedQuote where ConditionId in (" + s + ")"); dlSymbols.DataSource = dt; dlSymbols.DataBind(); } }
//******************************************************* // // The Page_Load event handler on this User Control is used to // obtain a DataReader of link information from the Links // table, and then databind the results to a templated DataList // server control. It uses the ASPNET.StarterKit.Portal.LinkDB() // data component to encapsulate all data functionality. // //******************************************************* private void Page_Load(object sender, System.EventArgs e) { // Set the link image type if (IsEditable) { linkImage = "~/images/edit.gif"; } else { linkImage = "~/images/navlink.gif"; } // Obtain links information from the Links table // and bind to the list control ASPNET.StarterKit.Portal.LinkDB links = new ASPNET.StarterKit.Portal.LinkDB(); myDataList.DataSource = links.GetLinks(ModuleId); myDataList.DataBind(); // Ensure that only users in role may add links if (PortalSecurity.IsInRoles(ModuleConfiguration.AuthorizedEditRoles)) { EditButton.Text = "Add Link"; EditButton.NavigateUrl = "~/DesktopModules/EditLinks.aspx?mid=" + ModuleId.ToString(); } }
/// <summary> /// The Page_Load event handler on this User Control is used to /// obtain a DataReader of link information from the Links /// table, and then databind the results to a templated DataList /// server control. It uses the Rainbow.LinkDB() /// data component to encapsulate all data functionality. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Page_Load(object sender, System.EventArgs e) { // Set the link image type if (IsEditable) { System.Web.UI.WebControls.Image myImage = portalSettings.GetCurrentTheme().GetImage("Buttons_Edit", "edit.gif"); linkImage = myImage.ImageUrl; linkTextKey = "EDIT_THIS_ITEM"; linkAlternateText = "Edit this item"; } else { System.Web.UI.WebControls.Image myImage = portalSettings.GetCurrentTheme().GetImage("NavLink", "navlink.gif"); linkImage = myImage.ImageUrl; linkTextKey = string.Empty; linkAlternateText = string.Empty; } // Obtain links information from the Links table // and bind to the datalist control LinkDB links = new LinkDB(); myDataList.DataSource = links.GetLinks(ModuleID, Version); myDataList.DataBind(); }
/// <summary> /// The Binddata method on this User Control is used to /// obtain a DataReader of event information from the FAQ /// table, and then databind the results to a templated DataList /// server control. It uses the Rainbow.FAGsDB() /// data component to encapsulate all data functionality. /// </summary> private void BindData() { FAQsDB questions = new FAQsDB(); myDataList.DataSource = questions.GetFAQ(ModuleID); myDataList.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { HtmlForm frm = (HtmlForm)FindControl("form1"); GHTTestBegin(frm); DataList1.DataBind();; }
//******************************************************* // // The BindData helper method is used to bind the list of // security roles for this portal to an asp:datalist server control // //******************************************************* private void BindData() { // unhide the Windows Authentication UI, if application if (User.Identity.AuthenticationType != "Forms") { windowsUserName.Visible = true; addNew.Visible = true; } // add the role name to the title if (roleName != "") { title.InnerText = "Role Membership: " + roleName; } // Get the portal's roles from the database RolesDB roles = new RolesDB(); // bind users in role to DataList usersInRole.DataSource = roles.GetRoleMembers(roleId); usersInRole.DataBind(); // bind all portal users to dropdownlist allUsers.DataSource = roles.GetUsers(); allUsers.DataBind(); }
/// <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(); }
/// <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(); }
private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { this._user = (Utilites.User)Session["User"]; ArrayList tabItems = new ArrayList(); tabItems.Add(new LinkTabs("Main Screen", "MainScreen.aspx?index=" + tabItems.Count)); if (this._user.IsUserCounciRole() || this._user.IsUserITAdminRole()) { tabItems.Add(new LinkTabs("Add New Call", "Addnewcall.aspx?index=" + tabItems.Count)); //tabItems.Add(new LinkTabs("Reports", "Reports.aspx?index=" + tabItems.Count)); tabItems.Add(new LinkTabs("Search", "Search.aspx?index=" + tabItems.Count)); tabItems.Add(new LinkTabs("Administration", "Administration.aspx?index=" + tabItems.Count)); } else { tabItems.Add(new LinkTabs("Search", "Search.aspx?index=" + tabItems.Count)); } linksTabs.DataSource = tabItems; linksTabs.SelectedIndex = (Request["index"] == null) ? 0 : Convert.ToInt32(Request["index"]); linksTabs.DataBind(); } }
/// <summary> /// The BindData helper method is used to bind the list of /// security roles for this portal to an asp:datalist server control /// </summary> private void BindData() { // unhide the Windows Authentication UI, if application if (User.Identity.AuthenticationType != "Forms") { windowsUserName.Visible = true; addNew.Visible = true; } // add the role name to the title if (roleName != string.Empty) { // Added EsperantusKeys for Localization // Mario Endara [email protected] june-1-2004 title.InnerText = Esperantus.Localize.GetString("ROLE_MEMBERSHIP") + roleName; } // Get the portal's roles from the database UsersDB users = new UsersDB(); // bind users in role to DataList System.Data.SqlClient.SqlDataReader drRoles = users.GetRoleMembers(roleID); usersInRole.DataSource = drRoles; usersInRole.DataBind(); drRoles.Close(); //by Manu, fixed bug 807858 // bind all portal users to dropdownlist System.Data.DataSet drUsers = users.GetUsers(portalSettings.PortalID); allUsers.DataSource = drUsers; allUsers.DataBind(); }
//******************************************************* // // The BindData helper method is used to bind the list of // security roles for this portal to an asp:datalist server control // //******************************************************* private void BindData() { // Bind the Email and Password UsersDB users = new UsersDB(); IDataReader dr = users.GetSingleUser(userName); // Read first row from database dr.Read(); Email.Text = (String)dr["email"]; Password.Text = ""; dr.Close(); // add the user name to the title if (userName != "") { title.InnerText = "Manage User: "******"PortalSettings"]; // Get the portal's roles from the database AdminDB admin = new AdminDB(); // bind all portal roles to dropdownlist allRoles.DataSource = admin.GetPortalRoles(portalSettings.PortalId); allRoles.DataBind(); }
void EnlazarDatos() { IDataReader dr = GruposBD.Obtener(); listaGrupos.DataSource = dr; listaGrupos.DataBind(); dr.Close(); }
/// <summary> /// The BindList method obtains the list of top-level messages /// from the Discussion table and then databinds them against /// the "TopLevelList" asp:datalist server control. It uses /// the Rainbow.DiscussionDB() data component to encapsulate /// all data access functionality. /// </summary> /// <returns>returns nothing (void)</returns> private void BindList() { // Obtain a list of discussion messages for the module and bind to datalist DiscussionDB discuss = new DiscussionDB(); TopLevelList.DataSource = discuss.GetTopLevelMessages(ModuleID); TopLevelList.DataBind(); }
/// <summary> Binds the threads from the database to the list control </summary> /// <param name="ItemID"> itemID of ANY of the topics in the thread </param> /// <returns>returns nothing</returns> private void BindList(int ItemID) { // Obtain a list of discussion messages for the module and bind to datalist DiscussionDB discuss = new DiscussionDB(); ThreadList.DataSource = discuss.GetThreadMessages(ItemID, 'Y'); // 'Y' means include rootmessage ThreadList.DataBind(); }
void EnlazarDatos() { IDataReader dr = ModulosBD.ObtenerDefiniciones(); listaDefiniciones.DataSource = dr; listaDefiniciones.DataBind(); dr.Close(); }
private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { dlPhotos.DataSource = GetPhotoList(); dlPhotos.DataBind(); } }
private void CommentListBind() { // 코멘트 목록 바인딩 BrdsCmtBiz objComment = new BrdsCmtBiz(db + "Comment"); CommentList.DataSource = objComment.GetBoardList(id); CommentList.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { HtmlForm frm = (HtmlForm)FindControl("Form1"); GHTTestBegin(frm); GHTActiveSubTest = GHTSubTest1; try { DataList1.DataBind();; } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTActiveSubTest = Ghtsubtest2; try { DataList2.DataBind(); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTActiveSubTest = Ghtsubtest3; try { DataList3.DataBind(); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTActiveSubTest = Ghtsubtest4; try { DataList4.DataBind(); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTActiveSubTest = Ghtsubtest5; try { DataList5.DataBind(); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTTestEnd(); }
private void Page_Load(object sender, System.EventArgs e) { /* */ IDataReader dr = EventosBD.ObtenerEventos(ModuloId); dataListEventos.DataSource = dr; dataListEventos.DataBind(); dr.Close(); }
//******************************************************* // // The Page_Load event handler on this User Control is used to // obtain a DataReader of event information from the Events // table, and then databind the results to a templated DataList // server control. It uses the ASPNetPortal.EventDB() // data component to encapsulate all data functionality. // //******************************************************* private void Page_Load(object sender, System.EventArgs e) { // Obtain the list of events from the Events table // and bind to the DataList Control ASPNetPortal.EventsDB events = new ASPNetPortal.EventsDB(); myDataList.DataSource = events.GetEvents(ModuleId); myDataList.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { BooksDB books = new BooksDB(); myDataList.DataSource = books.Getrb_BookList(ModuleID); myDataList.DataBind(); myDataList.RepeatColumns = Int32.Parse(Settings["Columns"].ToString()); }
//******************************************************* // // The BindList method obtains the list of top-level messages // from the Discussion table and then databinds them against // the "TopLevelList" asp:datalist server control. It uses // the ASPNET.StarterKit.Portal.DiscussionDB() data component to encapsulate // all data access functionality. // //******************************************************* private void BindList() { // Obtain a list of discussion messages for the module // and bind to datalist ASPNET.StarterKit.Portal.DiscussionDB discuss = new ASPNET.StarterKit.Portal.DiscussionDB(); TopLevelList.DataSource = discuss.GetTopLevelMessages(ModuleId); TopLevelList.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(); }
public void DataBindTwice () { DataList dl = new DataList (); dl.DataSource = new object [] { "1", "2", "3" }; dl.DataBind (); Assert.AreEqual (3, dl.Items.Count, "first binding"); dl.DataSource = new object [] { "a", "b", "c" }; dl.DataBind (); Assert.AreEqual (3, dl.Items.Count, "second binding"); }
/// <summary> /// 填充DataList组件 /// </summary> /// <param name="CuDL">当前DataList</param> /// <param name="SqlStr">SQL语句字符串</param> /// <param name="TableName">表名</param> public static void FillDList(DataList CuDL,string SqlStr,string TableName,string Wz) { if(SqlStr.Trim().Length==0 || TableName.Trim().Length==0) return; SqlConnection _Conn=connection(); try { CuDL.DataSource=dataset_2(_Conn,SqlStr,TableName); CuDL.DataBind(); } catch(Exception _Ex) { throw new Exception(_Ex.Message.ToString()); } finally { if(_Conn!=null) _Conn.Dispose(); } }
//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(); } }
public void DataListBind(DataList dl,DataSet ds) { dl.DataSource = ds.Tables[0].DefaultView; dl.DataBind(); }
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(); }
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(); }
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"); }
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(); }
/// <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(); }
/// <summary> /// Views the lecture note. /// </summary> /// <param name="dlistLectureNote">Datalist to display the lecture notes.</param> /// <param name="courseID">ID of the course.</param> public static void ViewLectureNote(DataList dlistLectureNote, string courseID) { LectureNoteList llist; DataTable dt = new DataTable(); llist = LectureNoteController.GetItem(courseID); DataColumn dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "LectureNote"; dt.Columns.Add(dc); DataColumn dc1 = new DataColumn(); dc1.DataType = Type.GetType("System.String"); dc1.ColumnName = "LectureNoteID"; dt.Columns.Add(dc1); DataColumn dc2 = new DataColumn(); dc2.DataType = Type.GetType("System.String"); dc2.ColumnName = "LFileLocation"; dt.Columns.Add(dc2); DataRow dr; if (llist != null) { foreach (LectureNote ln in llist) { dr = dt.NewRow(); dr["LectureNote"] = ln.LTitle; dr["LectureNoteID"] = ln.LectureId; dr["LFileLocation"] = ln.LFileLocation; dt.Rows.Add(dr); } } dlistLectureNote.DataSource = dt; dlistLectureNote.DataBind(); }
public static int GetPagingData(DataList bindControl, DataTable dataTable, int currentPageIndex) { CurrentPageIndex = currentPageIndex; pds.DataSource = dataTable.DefaultView; pds.AllowPaging = true; pds.PageSize = PageRowTotal; pds.CurrentPageIndex = CurrentPageIndex - 1; TotalPage = pds.PageCount; bindControl.DataSource = pds; bindControl.DataBind(); return (TotalPage < currentPageIndex) ? -1 : 0; }
//Fill A DataList public void SelectQueryFillDataList(string selectQuery, DataList dtl) { dtl.DataSource = SelectQueryFillDataTable(selectQuery); dtl.DataBind(); }
/// <summary> /// Creates an iterative control. /// </summary> /// <param name="ctrlType">Type of control to create.</param> protected Control GetIterativeControl(Type ctrlType, bool a_AddToPage) { if (ctrlType.Equals(typeof(Repeater))) { Repeater l_rep = new Repeater(); l_rep.ItemTemplate = new RepeaterTemplate(); l_rep.DataSource = m_aDataSource; l_rep.DataBind(); if (a_AddToPage) { GHTActiveSubTest.Controls.Add(l_rep); } return l_rep; } else if (ctrlType.Equals(typeof(DataList))) { DataList l_dataList = new DataList(); l_dataList.ItemTemplate = new DataListTemplate(); l_dataList.DataSource = m_aDataSource; l_dataList.DataBind(); if (a_AddToPage) { GHTActiveSubTest.Controls.Add(l_dataList); } return l_dataList; } else if (ctrlType.Equals(typeof(DataGrid))) { DataGrid l_dataGrid = new DataGrid(); l_dataGrid.DataSource = m_dtDataSource; l_dataGrid.DataBind(); if (a_AddToPage) { GHTActiveSubTest.Controls.Add(l_dataGrid); } return l_dataGrid; } else { throw new ArgumentOutOfRangeException("ctrlType", ctrlType, "Allowed types are Repeater, DataList or DataGrid"); } }