Beispiel #1
0
Datei: test.cs Projekt: mono/gert
	static int Main ()
	{
		DataList user_list = new DataList ();
		List<string> str = new List<string> ();
		str.Add ("foo");
		user_list.DataSource = str;
		user_list.DataBind ();

		StringWriter sw = new StringWriter ();
		HtmlTextWriter h = new HtmlTextWriter (sw);
		user_list.RenderControl (h);

		string expected = string.Format ("<table cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;\">{0}"
			+ "\t<tr>{0}"
			+ "\t\t<td></td>{0}"
			+ "\t</tr>{0}"
			+ "</table>", Environment.NewLine);

		if (sw.ToString () != expected) {
			Console.WriteLine (sw.ToString ());
			return 1;
		}

		return 0;
	}
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            var lcc = new List <LinkCategory>();

            lcc.AddRange(Repository.GetActiveCategories());
            CatList.DataSource = lcc;
            CatList.DataBind();
        }
Beispiel #3
0
    void load(DataList x, string maloai)
    {
        HangBLL   hb  = new HangBLL();
        ArrayList lst = new ArrayList();

        lst          = (ArrayList)hb.showHang("select * from Hang where maloai=" + maloai + "order by MaHang desc");
        x.DataSource = lst;
        x.DataBind();
    }
Beispiel #4
0
 public void dlBind(DataList dlName, DataTable dsTable)
 {
     if (dsTable != null)
     {
         dlName.DataSource   = dsTable.DefaultView;
         dlName.DataKeyField = dsTable.Columns[0].ToString();
         dlName.DataBind();
     }
 }
Beispiel #5
0
    protected void parent_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataList    list  = e.Item.FindControl("child") as DataList;
        DataRowView drv   = e.Item.DataItem as DataRowView;
        DataTable   table = t_2.type_2list(int.Parse(drv["typeid_1"].ToString()), "");

        list.DataSource = table.DefaultView;
        list.DataBind();
    }
Beispiel #6
0
 /// <summary>
 /// 对DataList控件进行绑定
 /// </summary>
 /// <param name="dlName">DataList控件名</param>
 /// <param name="dsTable">数据集DataSet的表的集合</param>
 public void dlBind(DataList dlName,DataTable dsTable)
 {
     if (dsTable != null)
     {
         dlName.DataSource = dsTable.DefaultView;
         dlName.DataKeyField = dsTable.Columns[0].ToString();
         dlName.DataBind();
     }
 }
Beispiel #7
0
    //=================================================
    //功能描述:对datalist进行数据绑定,无排序
    //输入参数:sql,查询的SQL语句;dl,需要绑定的datalist控件
    //返回值:无
    //时间:2013.08.20
    //=================================================
    public static void binddatalist(string sql, DataList dl)
    {
        OleDbConnection conn = DB.Getconn();
            DataSet ds = getdataset(sql);
            dl.DataSource = ds.Tables[0].DefaultView;

        closeConnection();
            dl.DataBind();
    }
Beispiel #8
0
 protected void rptconfig1_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         DataList repinner = (DataList)e.Item.FindControl("rptconfig_inner1");
         repinner.DataSource = filterdataset(dsexcel.Tables[2], "type", DataBinder.Eval(e.Item.DataItem, "type").ToString());
         repinner.DataBind();
     }
 }
Beispiel #9
0
    public DataView loadData(ListInfo info, DBManager db, DataList repeater)
    {
        DBFilter filter = binding.createFilter();

        DateTime dtPeriodFr, dtPeriodTo;

        if (DateTime.TryParse(RequestFromDate.Value, out dtPeriodFr))
        {
            filter.add(new Match("RequestLateWaiveCreateDate", ">=", dtPeriodFr));
        }
        if (DateTime.TryParse(RequestToDate.Value, out dtPeriodTo))
        {
            filter.add(new Match("RequestLateWaiveCreateDate", "<", dtPeriodTo.AddDays(1)));
        }

        filter.add(new Match("c.EmpID", this.CurID));

        if (!EmpRequestStatus.SelectedValue.Equals(string.Empty))
        {
            if (EmpRequestStatus.SelectedValue.Equals("REQUEESTSTATUS_PROCESSING"))
            {
                AND andTerms = new AND();
                andTerms.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_APPROVED));
                andTerms.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_CANCELLED));
                andTerms.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_REJECTED));
                filter.add(andTerms);
            }
            else if (EmpRequestStatus.SelectedValue.Equals("REQUEESTSTATUS_END_PROCESS"))
            {
                OR orTerms = new OR();
                orTerms.add(new Match("EmpRequestStatus", EEmpRequest.STATUS_APPROVED));
                orTerms.add(new Match("EmpRequestStatus", EEmpRequest.STATUS_CANCELLED));
                orTerms.add(new Match("EmpRequestStatus", EEmpRequest.STATUS_REJECTED));
                filter.add(orTerms);
            }
        }

        string select = "c.*, a.AttendanceRecordDate, a.AttendanceRecordActualLateMins, r.EmpRequestStatus, r.EmpRequestLastAuthorizationWorkFlowIndex, r.EmpRequestID ";
        string from   = "from [" + db.dbclass.tableName + "] c " +
                        " LEFT JOIN " + EAttendanceRecord.db.dbclass.tableName + " a On c.AttendanceRecordID = a.AttendanceRecordID " +
                        " LEFT JOIN " + EEmpRequest.db.dbclass.tableName + " r On r.EmpRequestRecordID = c.RequestLateWaiveID and r.EmpRequestType = '" + EEmpRequest.TYPE_EELATEWAIVE + "'";


        DataTable table = filter.loadData(dbConn, info, select, from);

        view = new DataView(table);

        ListFooter.Refresh();

        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }
        return(view);
    }
Beispiel #10
0
        public void InitBindData(Control c, Wuqi.Webdiyer.AspNetPager aspnet, string tbname, string tbcolumn, string sqlwhere)
        {
            aspnet.RecordCount = GetRows(tbname, sqlwhere);
            if (aspnet.RecordCount > 0)
            {
                string contype = c.GetType().ToString();

                DataSet ds = GetList(aspnet.PageSize, aspnet.CurrentPageIndex, sqlwhere, tbname, tbcolumn);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (contype.IndexOf("GridView") != -1)
                    {
                        GridView gv = (GridView)c;
                        gv.DataSource = ds;
                        gv.DataBind();
                    }
                    else if (contype.IndexOf("Repeater") != -1)
                    {
                        Repeater rep = (Repeater)c;
                        rep.DataSource = ds;
                        rep.DataBind();
                    }
                    else if (contype.IndexOf("DataList") != -1)
                    {
                        DataList dl = (DataList)c;
                        dl.DataSource = ds;
                        dl.DataBind();
                    }
                }

                c.Visible = true;
            }
            else
            {
                string contype = c.GetType().ToString();
                if (contype.IndexOf("GridView") != -1)
                {
                    GridView gv = (GridView)c;
                    gv.DataSource = null;
                    gv.DataBind();
                }
                else if (contype.IndexOf("Repeater") != -1)
                {
                    Repeater rep = (Repeater)c;
                    rep.DataSource = null;
                    rep.DataBind();
                }
                else if (contype.IndexOf("DataList") != -1)
                {
                    DataList dl = (DataList)c;
                    dl.DataSource = null;
                    dl.DataBind();
                }
                c.Visible = false;
            }
        }
Beispiel #11
0
        /// <summary>
        /// 绑定首页商品推荐tab
        /// </summary>
        /// <param name="classNum">类别</param>
        /// <param name="dl">上面两个推荐位</param>
        /// <param name="dl2">下面四个推荐位</param>
        protected void bind(int classNum, DataList dl, DataList dl2)
        {
            dtTable = new DataTable();
            DataColumn[] dataColumns = new DataColumn[6];
            string[]     colunm      = { "BookID", "BookName", "picUrl", "BookUrl", "OriginalPrice", "MarketPrice" };
            for (int k = 0; k < colunm.Length; k++)
            {
                dataColumns[k] = new DataColumn(colunm[k]);
                dtTable.Columns.Add(dataColumns[k]);
            }
            string sql = "select BookID,BookName,picUrl,OriginalPrice,MarketPrice from  Goods_Recommend_ByClass,dbo.Goods_Class where Goods_Class.ClassID=Goods_Recommend_ByClass.ClassID AND Goods_Recommend_ByClass.ClassID=@Class";

            SqlParameter[] parameters =
            {
                new SqlParameter("Class", classNum)
            };
            DataSet ds = operate.GetTable(sql, parameters);
            DataRow row;

            for (int j = 0; j <= 3; j++)
            {
                row                  = dtTable.NewRow();
                row["BookID"]        = ds.Tables[0].Rows[j][0].ToString();
                row["BookName"]      = ds.Tables[0].Rows[j][1].ToString();
                row["picUrl"]        = ds.Tables[0].Rows[j][2].ToString();
                row["OriginalPrice"] = ds.Tables[0].Rows[j][3].ToString();
                row["MarketPrice"]   = ds.Tables[0].Rows[j][4].ToString();
                row["BookUrl"]       = "Goods/Detail.aspx?id=" + ds.Tables[0].Rows[j][0].ToString();
                dtTable.Rows.Add(row);
            }
            dl.DataSource = dtTable.DefaultView;
            dl.DataBind();

            DataTable dtTable2 = new DataTable();

            DataColumn[] dataColumns2 = new DataColumn[6];
            string[]     colunm2      = { "BookID", "BookName", "picUrl", "BookUrl", "OriginalPrice", "MarketPrice" };
            for (int k = 0; k < colunm2.Length; k++)
            {
                dataColumns2[k] = new DataColumn(colunm2[k]);
                dtTable2.Columns.Add(dataColumns2[k]);
            }
            for (int j = 4; j <= 5; j++)
            {
                row                  = dtTable2.NewRow();
                row["BookID"]        = ds.Tables[0].Rows[j][0].ToString();
                row["BookName"]      = ds.Tables[0].Rows[j][1].ToString();
                row["picUrl"]        = ds.Tables[0].Rows[j][2].ToString();
                row["OriginalPrice"] = ds.Tables[0].Rows[j][3].ToString();
                row["MarketPrice"]   = ds.Tables[0].Rows[j][4].ToString();
                row["BookUrl"]       = "Goods/Detail.aspx?id=" + ds.Tables[0].Rows[j][0].ToString();
                dtTable2.Rows.Add(row);
            }
            dl2.DataSource = dtTable2.DefaultView;
            dl2.DataBind();
        }
    public static void Data_Preview_6(string Category, DataList Data_SubList, DataList Data_Product, DataList Data_More_Product, DataList Data_More_Product_2, DataList Data_More_Product_3, DataList Data_More_Product_4)
    {
        DataTable dt = null;

        dt = db.QP("exec Common_Proc_Category_Select @P0,@P1", Category, "Product").Tables[0];

        if (dt.Rows.Count > 0)
        {
            Data_SubList.DataSource = dt;
            Data_SubList.DataBind();
        }
        dt = null;
        dt = db.QP("exec Product_Data_List @P0", Category).Tables[0];

        if (dt.Rows.Count > 0)
        {
            Data_Product.DataSource = dt;
            Data_Product.DataBind();
        }

        dt = null;
        dt = db.QP("exec Product_Data_List @P0", Category).Tables[0];

        if (dt.Rows.Count > 0)
        {
            Data_More_Product.DataSource = dt;
            Data_More_Product.DataBind();
        }
        dt = null;
        dt = db.QP("exec Product_Data_List @P0", Category).Tables[0];

        if (dt.Rows.Count > 0)
        {
            Data_More_Product_2.DataSource = dt;
            Data_More_Product_2.DataBind();
        }

        dt = null;
        dt = db.QP("exec Product_Data_List @P0", Category).Tables[0];

        if (dt.Rows.Count > 0)
        {
            Data_More_Product_3.DataSource = dt;
            Data_More_Product_3.DataBind();
        }


        dt = null;
        dt = db.QP("exec Product_Data_List @P0", Category).Tables[0];

        if (dt.Rows.Count > 0)
        {
            Data_More_Product_4.DataSource = dt;
            Data_More_Product_4.DataBind();
        }
    }
Beispiel #13
0
    //=================================================
    //功能描述:对datalist进行数据绑定,无排序
    //输入参数:sql,查询的SQL语句;dl,需要绑定的datalist控件
    //返回值:无
    //时间:2013.08.20
    //=================================================
    public static void binddatalist(string sql, DataList dl)
    {
        OleDbConnection conn = DB.Getconn();
        DataSet         ds   = getdataset(sql);

        dl.DataSource = ds.Tables[0].DefaultView;

        closeConnection();
        dl.DataBind();
    }
Beispiel #14
0
 protected void gvItemHistory_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (DataControlRowType.DataRow == e.Row.RowType)
     {
         DataList rptr     = (DataList)e.Row.FindControl("rptQuoted");
         string   Document = ((Label)e.Row.FindControl("lblReqsnNO")).ToolTip;
         rptr.DataSource = BLL_PURC_Common.Get_QuotedRates_ByItem(Document, Request.QueryString["item_ref_code"]);
         rptr.DataBind();
     }
 }
Beispiel #15
0
        public void findAll(TextBox textBox, DataList dataList)
        {
            string query = "select * from Product where Name LIKE '%" + textBox.Text + "%'";
            var    sqlda = new SqlDataAdapter(query, connect.setConnect());
            var    ds    = new DataSet();

            sqlda.Fill(ds, "Product");
            dataList.DataSource = ds.Tables["Product"];
            dataList.DataBind();
        }
Beispiel #16
0
    public void DataPage(string sqlcom, DataList MarketDetailDl, Label lblCurPage, Label lblTnum, Label lblEachPage, HyperLink lnkFirst, HyperLink lnkLast, HyperLink lnkPrev, HyperLink lnkNext, HttpRequest Request)
    {
        DataAccess data = new DataAccess();
        data.Connection();
        SqlCommand cmd = data.excute(sqlcom);
        DataSet ds = data.Fill(cmd);
        MarketDetailDl.DataSource = ds.Tables[0].DefaultView;
        MarketDetailDl.DataBind();
        PagedDataSource objPage = new PagedDataSource();//创建分页类
        objPage.DataSource = ds.Tables["Table"].DefaultView;//设置数据源

        objPage.AllowPaging = true;
        objPage.PageSize = 5;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            CurPage = Math.Min(CurPage, objPage.PageCount);
            CurPage = Math.Max(CurPage, 1);
        }
        else
            CurPage = 1;
        objPage.CurrentPageIndex = CurPage - 1;
        TotalPage = objPage.PageCount;
        Tnum = objPage.DataSourceCount;
        EachPage = objPage.Count;
        lblCurPage.Text = "第 " + CurPage.ToString() + " / " + TotalPage.ToString() + " 页";
        lblTnum.Text = "共: " + Tnum + " 条记录";
        lblEachPage.Text = "每页有: " + EachPage.ToString() + " 条记录";

        if (objPage.CurrentPageIndex != 0)
            lnkFirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage-CurPage +1);
        if (objPage.CurrentPageIndex != TotalPage - 1)
            lnkLast.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(TotalPage);

        if (!objPage.IsFirstPage)
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
        if (!objPage.IsLastPage)
            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);

        MarketDetailDl.DataSource = objPage;
        MarketDetailDl.DataBind();
    }
Beispiel #17
0
    public static void BindDataList2(DataList dl)
    {
        SqlConnection conn   = Conn();
        string        sqlstr = "select top 7 * from news where newstype='班级新闻' order by id desc";
        SqlCommand    cmd    = new SqlCommand(sqlstr, conn);
        SqlDataReader sdr    = cmd.ExecuteReader();

        dl.DataSource = sdr;
        dl.DataBind();
    }
 public void setDatalist(DataTable dtDatos, DataList dtlDatalist)
 {
     if (dtDatos != null)
     {
         PagedDataSource objPds = new PagedDataSource();
         objPds.DataSource      = dtDatos.DefaultView;
         dtlDatalist.DataSource = objPds;
         dtlDatalist.DataBind();
     }
 }
Beispiel #19
0
 protected void outerDataList_OnItemDataBound(object sender, DataListItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         DataRowView drv           = e.Item.DataItem as DataRowView;
         DataList    innerDataList = e.Item.FindControl("innerDataList") as DataList;
         innerDataList.DataSource = drv.CreateChildView("QA_Relation");
         innerDataList.DataBind();
     }
 }
Beispiel #20
0
        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();
        }
Beispiel #21
0
    void LoadShippingList()
    {
        DataList dtAddresses = (DataList)wizCheckout.FindControl("dtAddresses");

        if (dtAddresses != null)
        {
            dtAddresses.DataSource = OrderController.GetUserAddresses();
            dtAddresses.DataBind();
        }
    }
Beispiel #22
0
    void load(DataList x, string maloai)
    {
        //Lấy ra số lượng hàng theo từng loại hàng
        HangBLL   hb  = new HangBLL();
        ArrayList lst = new ArrayList();

        lst          = (ArrayList)hb.showHang("select top 5 * from Hang where maloai=" + maloai + "order by MaHang desc");
        x.DataSource = lst;
        x.DataBind();
    }
Beispiel #23
0
        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();
        }
    private void bind()
    {
        int count = BlogManager.GetInstance().BlogBaseModel.BlogModel.RecentCommentListCount;
        CommentBindModel bindModel = CommentManager.GetInstance().GetRecentCommentList(count);

        DataList dlRecentComment = (DataList)snap_RecentComment.FindControl("panel1").FindControl("dlRecentComment");

        dlRecentComment.DataSource = bindModel;
        dlRecentComment.DataBind();
    }
 public void BindData()
 {
     this.LauncherRecommList = new GroupBLL().GetLauncherRecommend(SchemeID, GroupTypeID);
     DataList.DataSource     = this.LauncherRecommList;
     DataList.DataBind();
     if (PageType == "new" && LauncherRecommList.Count > 0)
     {
         Button1.Visible = true;
     }
 }
    protected void dlChild_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item | e.Item.ItemType == ListItemType.AlternatingItem)
        {
            CheckBox      ChkIsAdd = (CheckBox)e.Item.FindControl("ChkIsAdd");
            HtmlTableCell objIsadd = (HtmlTableCell)e.Item.FindControl("tdIsAdd");
            if (ChkIsAdd.Visible == false)
            {
                objIsadd.InnerHtml = "NA";
            }

            CheckBox      ChkIsEdit = (CheckBox)e.Item.FindControl("ChkIsEdit");
            HtmlTableCell objIsEdit = (HtmlTableCell)e.Item.FindControl("tdIsEdit");
            if (ChkIsEdit.Visible == false)
            {
                objIsEdit.InnerHtml = "NA";
            }

            CheckBox      ChkIsDelete = (CheckBox)e.Item.FindControl("ChkIsDelete");
            HtmlTableCell objIsDelete = (HtmlTableCell)e.Item.FindControl("tdIsDelete");
            if (ChkIsDelete.Visible == false)
            {
                objIsDelete.InnerHtml = "NA";
            }

            DataList  dlChild = (DataList)e.Item.Parent;
            DataList  dl      = (DataList)e.Item.FindControl("dlChild2");
            DataTable dt      = new DataTable();
            if (string.IsNullOrEmpty(hdnPKID.Value))
            {
                if ((bool)Session[appFunctions.Session.IsSuperAdmin.ToString()] == true)
                {
                    dt = objRole.LoadPermissionTab(0.ToString(), dlChild.DataKeys[e.Item.ItemIndex].ToString(), "", (bool)Session[appFunctions.Session.IsSuperAdmin.ToString()]);
                }
                else
                {
                    dt = objRole.LoadPermissionTab(Session[appFunctions.Session.RoleID.ToString()].ToString(), dlChild.DataKeys[e.Item.ItemIndex].ToString(), "", (bool)Session[appFunctions.Session.IsSuperAdmin.ToString()]);
                }
            }
            else
            {
                if ((bool)Session[appFunctions.Session.IsSuperAdmin.ToString()] == true)
                {
                    dt = objRole.LoadPermissionTab(hdnPKID.Value, dlChild.DataKeys[e.Item.ItemIndex].ToString(), "", (bool)Session[appFunctions.Session.IsSuperAdmin.ToString()]);
                }
                else
                {
                    dt = objRole.LoadPermissionTab(Session[appFunctions.Session.RoleID.ToString()].ToString(), dlChild.DataKeys[e.Item.ItemIndex].ToString(), "", (bool)Session[appFunctions.Session.IsSuperAdmin.ToString()], hdnPKID.Value);
                }
            }

            dl.DataSource = dt;
            dl.DataBind();
        }
    }
Beispiel #27
0
        /// <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();
        }
    public static void Process_Pagination(DataList _list, Repeater _rept, LinkButton _prev, LinkButton _next, int _size, int _pagenumber, IEnumerable _source, int _totalrecords)
    {
        int total_pages = (int)Math.Ceiling((double)_totalrecords / _size);

        if (total_pages > 1)
        {
            // Previous Link Scripting
            if (_pagenumber > 1)
            {
                _prev.Visible = true;
                int firstbound = (((_pagenumber - 1) - 1) * _size) + 1;
                if (firstbound < 0)
                {
                    firstbound = 1;
                }
                int lastbound = firstbound + _size - 1;
                _prev.ToolTip = "Showing " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
            }
            else
            {
                _prev.Visible = false;
            }
            // Next Link Scripting
            if (_pagenumber < total_pages)
            {
                _next.Visible = true;
                int firstbound = (((_pagenumber + 1) - 1) * _size) + 1;
                int lastbound  = firstbound + _size - 1;
                if (lastbound > _totalrecords)
                {
                    lastbound = _totalrecords;
                }
                _next.ToolTip = "Showing " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
            }
            else
            {
                _next.Visible = false;
            }

            // main pagination links
            ArrayList arr = Return_Pagination_Link_v2(total_pages, _pagenumber);
            _rept.Visible    = true;
            _rept.DataSource = arr;
            _rept.DataBind();
        }
        else
        {
            _rept.Visible = false;
            _next.Visible = false;
            _prev.Visible = false;
        }

        _list.DataSource = _source;
        _list.DataBind();
    }
Beispiel #29
0
    public void bindnested(int itemindex)
    {
        int       z              = itemindex;
        int       id             = Convert.ToInt32(DataList1.DataKeys[itemindex]);
        admin     ad             = new admin();
        DataTable dt             = ad.getsubsubcategorywithcountbysubcategory(id);
        DataList  nesteddatalist = (DataList)DataList1.Items[itemindex].FindControl("DataList2");

        nesteddatalist.DataSource = dt;
        nesteddatalist.DataBind();
    }
Beispiel #30
0
        public void loadDataList(String sql, DataList dtl)
        {
            connectDB();
            SqlDataAdapter adapter = new SqlDataAdapter(sql, sqlcon);

            adapter.Fill(dt);
            dtl.DataSource = dt;
            dtl.DataBind();
            close();
            adapter.Dispose();
        }
Beispiel #31
0
    public static void Listeler_Area_ID(string Proc, DataList Datalist, string Area, int ID, int Top)
    {
        //try
        //{
        DataTable dt = db.QP("exec  " + Proc + " @P0,@P1,@P1", Area, ID, Top).Tables[0];

        Datalist.DataSource = dt;
        Datalist.DataBind();
        //}
        //catch { }
    }
Beispiel #32
0
        protected void dlBookings_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            DataList dl        = (DataList)e.Item.FindControl("dlBookingDetails");
            int      bookingId = Convert.ToInt32(((Label)e.Item.FindControl("BookingIdLabel")).Text);

            dl.DataSource = (from bookingObj in bookings
                             where bookingObj.BookingId == bookingId
                             select bookingObj.BookingDetails).Single();

            dl.DataBind();
        }
Beispiel #33
0
    public void dlDataBind(DataList dl, string sqlstr)
    {
        sqlconn.Open();
        SqlDataAdapter myda = new SqlDataAdapter(sqlstr, sqlconn);
        DataSet        myds = new DataSet();

        myda.Fill(myds);
        dl.DataSource = myds;
        dl.DataBind();
        sqlconn.Close();
    }
Beispiel #34
0
        public void changeLinks()
        {
            DbProvider dbSelectZip = new DbProvider();
            int        sideType    = 0;
            string     admin       = Convert.ToString(Request.Cookies["adminId"].Value);

            //For Customers
            DataList MyDataListCustomers = (DataList)Page.Master.FindControl("dtlcustomers");

            sideType = 1;
            DataSet dsAdminCustomers = dbSelectZip.GetSideLinkInfo(Convert.ToInt32(admin), sideType);

            if (dsAdminCustomers.Tables[0].Rows.Count > 0)
            {
                if (dsAdminCustomers != null && dsAdminCustomers.Tables.Count > 0 && dsAdminCustomers.Tables[0].Rows.Count > 0)
                {
                    MyDataListCustomers.DataSource = dsAdminCustomers;
                    MyDataListCustomers.DataBind();
                }
            }
            //for Site Functions

            DataList MyDataListSiteFunctions = (DataList)Page.Master.FindControl("dtlsitefunctions");

            sideType = 2;
            DataSet dsAdminSiteFunctions = dbSelectZip.GetSideLinkInfo(Convert.ToInt32(admin), sideType);

            if (dsAdminSiteFunctions.Tables[0].Rows.Count > 0)
            {
                if (dsAdminSiteFunctions != null && dsAdminSiteFunctions.Tables.Count > 0 && dsAdminSiteFunctions.Tables[0].Rows.Count > 0)
                {
                    MyDataListSiteFunctions.DataSource = dsAdminSiteFunctions;
                    MyDataListSiteFunctions.DataBind();
                }
            }

            //for reports

            DataList MyDataListReports = (DataList)Page.Master.FindControl("dtlreports");

            sideType = 3;
            DataSet dsAdminReports = dbSelectZip.GetSideLinkInfo(Convert.ToInt32(admin), sideType);

            if (dsAdminReports.Tables[0].Rows.Count > 0)
            {
                if (dsAdminReports != null && dsAdminReports.Tables.Count > 0 && dsAdminReports.Tables[0].Rows.Count > 0)
                {
                    MyDataListReports.DataSource = dsAdminReports;
                    MyDataListReports.DataBind();
                }
            }

            dbSelectZip.dispose();
        }
Beispiel #35
0
 /// <summary>
 /// 创建时间:2008-4-18
 /// 该方法实现的是将数据绑定到DataList控件中
 /// 参数:dl 要绑定的DataList控件的控件的名称
 /// 参数:SqlStr 执行的Sql语句
 public void EXECBindDataList(DataList dl, string SqlStr)
 {
     SqlConnection con = new SqlConnection(GetConStr());
     con.Open();//打开数据库连接
     SqlDataAdapter ada = new SqlDataAdapter(SqlStr, con);
     DataSet ds = new DataSet();
     ada.Fill(ds);
     dl.DataSource = ds;
     dl.DataBind();
     con.Close();//关闭数据库连接
 }
Beispiel #36
0
 /// 邦定DataList数据
 /// <summary>
 /// 邦定DataList数据
 /// </summary>
 /// <param name="Dl">DataList</param>
 /// <param name="sql">SQL语句</param>
 /// <param name="KeyField">关联DataList里DataKeyField的键字段</param>
 /// <returns></returns>
 public int BindDataList(DataList Dl, string sql, string KeyField)
 {
     Regex reg = new Regex(_noSafe, RegexOptions.IgnoreCase);
     if (reg.IsMatch(sql))
     {
         throw new System.Exception("警告!!不安全SELECT! ");
     }
     try
     {
         DataSet ds = GetDS(sql);
         Dl.DataSource = ds;
         Dl.DataKeyField = KeyField;
         Dl.DataBind();
         return ds.Tables[0].Rows.Count;
     }
     catch
     {
         return 0;
     }
 }
Beispiel #37
0
    public static DataList PagesLoad(DataList Repeater1)
    {
        //// String com = System.Configuration.ConfigurationManager.AppSettings["com.systemsoriginals.www.webservice"].ToString();

        //          * ++++++++++++++++++++++**************

        DataSet ds = new DataSet();

         XmlNode CurrNode;

        XmlDocument HomeSettings = new XmlDocument();

        // m_pages

        //strPhysicalPath = messages.strPhysicalPath;   // Request.MapPath("~\\XML\\changeText.xml");

         //messages.xml.Load(strPhysicalPath);

        HomeSettings.Load(strPhysicalPath);

        CurrNode = HomeSettings.SelectSingleNode("DonateExl");

        XmlNodeList CurrNodes = CurrNode.ChildNodes;
        int xx = 0;

        messages.arrlstPages.Clear();

        if (messages.arrlstPages.Count == 0)
        {
            foreach (XmlNode node in CurrNodes)
            {

                if (node.Name.ToString() == "DonateHomePage")
                {
                    messages.defaultpage = node.InnerText;

                }
                else
                {
                    clsPages clspages = new clsPages(node.Name.ToString(), strPhysicalPath);

                    messages.arrlstPages.Add(clspages);
                }

            }

        }

        messages.lstPages.Clear();
        foreach (XmlNode node in CurrNodes)
        {

            string nodeAttr =  node.Attributes.Count>0?   node.Attributes[0].Value : "";

            messages.lstPages.Add(node.Name.ToString() + "," + nodeAttr);

        }

        Repeater1.DataSource = messages.lstPages;
        Repeater1.DataBind();

        messages.qulstPages.Clear();
        messages.qulstPages.Enqueue(lstPages);
        return Repeater1;
    }
Beispiel #38
0
 public static void bindDataList(string command, DataList dl)
 {
     dl.DataSource = getDataTable(command);
     dl.DataBind();
 }
    // Process Pagination ver 2.0 // Compatible with Hyperlinks
    // Compatible with both MySQL / SQL SERVER.
    // Support Advance Pagination
    public static void Process_Pagination_v2(DataList _list,Repeater _rept,HyperLink _prev,HyperLink _next,int _size, int _pagenumber, IEnumerable _source, int _totalrecords)
    {
        if (Site_Settings.Pagination_Type == 1)
        {
            // MySQL Compatible
            int total_pages = (int)Math.Ceiling((double)_totalrecords / _size);
            if (total_pages > 1)
            {
                // Previous Link Scripting
                if (_pagenumber > 1)
                {
                    _prev.Visible = true;
                    int firstbound = (((_pagenumber - 1) - 1) * _size) + 1;
                    if (firstbound < 0)
                        firstbound = 1;
                    int lastbound = firstbound + _size - 1;
                    _prev.ToolTip = "Showing " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
                }
                else
                {
                    _prev.Visible = false;
                }
                // Next Link Scripting
                if (_pagenumber < total_pages)
                {
                    _next.Visible = true;
                    int firstbound = (((_pagenumber + 1) - 1) * _size) + 1;
                    int lastbound = firstbound + _size - 1;
                    if (lastbound > _totalrecords)
                        lastbound = _totalrecords;
                    _next.ToolTip = "Showing " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
                }
                else
                {
                    _next.Visible = false;
                }

                // main pagination links
                ArrayList arr = Pagination_Process.Return_Pagination_Link_v2(total_pages, _pagenumber);
                _rept.Visible = true;
                _rept.DataSource = arr;
                _rept.DataBind();
            }
            else
            {
                _rept.Visible = false;
                _next.Visible = false;
                _prev.Visible = false;
            }

            _list.DataSource = _source;
            _list.DataBind();

        }
        else
        {
            // SQL SERVER Compatible
            PagedDataSource objPds = new PagedDataSource();
            objPds.DataSource = _source;
            objPds.AllowPaging = true;

            objPds.PageSize = _size;
            objPds.CurrentPageIndex = (_pagenumber - 1);

            if (!objPds.IsFirstPage)
            {
                _prev.Visible = true;
                int firstbound = (((_pagenumber - 1) - 1) * _size) + 1;
                if (firstbound < 0)
                    firstbound = 1;

                int lastbound = firstbound + _size - 1;

                _prev.ToolTip = "Showing previous " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
            }
            else
            {
                _prev.Visible = false;
            }
            if (!objPds.IsLastPage)
            {
                int firstbound = (((_pagenumber + 1) - 1) * _size) + 1;
                int lastbound = firstbound + _size - 1;
                if (lastbound > _totalrecords)
                    lastbound = _totalrecords;

                _next.ToolTip = "Showing next " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
                _next.Visible = true;
            }
            else
            {
                _next.Visible = false;
            }

            ArrayList arr = Pagination_Process.Return_Pagination_Link_v2(objPds.PageCount, _pagenumber);
            if (objPds.PageCount > 1)
            {
                _rept.Visible = true;
                _rept.DataSource = arr;
                _rept.DataBind();
            }
            else
            {
                _rept.Visible = false;
            }

            _list.DataSource = objPds;
            _list.DataBind();
        }
    }
Beispiel #40
0
 //FOR DATALIST
 public void Filldatalist(string strQuery, DataList dtl)
 {
     adp = new SqlDataAdapter(strQuery, sqlCon);
     ds = new DataSet();
     adp.Fill(ds);
     dtl.DataSource = ds;
     dtl.DataBind();
 }
    public void DGIBind(int P_Int_Deplay, string P_Str_srcTable,DataList DLName)
    {
        SqlConnection myConn = dbObj.GetConnection();
        SqlCommand myCmd = new SqlCommand("Proc_DeplayGInfo", myConn);
        myCmd.CommandType = CommandType.StoredProcedure;
        //
        SqlParameter Deplay = new SqlParameter("@Deplay", SqlDbType.Int, 4);
        Deplay.Value = P_Int_Deplay;
        myCmd.Parameters.Add(Deplay);
        //
        myConn.Open();
        try
        {
            myCmd.ExecuteNonQuery();

        }
        catch (Exception ex)
        {
            throw (ex);
        }
        finally
        {
            myCmd.Dispose();
            myConn.Close();

        }
        SqlDataAdapter da = new SqlDataAdapter(myCmd);
        DataSet ds = new DataSet();

        da.Fill(ds, P_Str_srcTable);
        DLName.DataSource = ds.Tables[P_Str_srcTable].DefaultView;
        DLName.DataBind();
    }
 public void DLClassBind(DataList  dlName)
 {
     string P_Str_SqlStr = "select * from tb_Class";
     SqlConnection myConn = dbObj.GetConnection();
     SqlDataAdapter da = new SqlDataAdapter(P_Str_SqlStr, myConn);
     DataSet ds = new DataSet();
     da.Fill(ds, "Class");
     dlName.DataSource = ds.Tables["Class"].DefaultView;
     dlName.DataBind();
 }
Beispiel #43
0
 public void datalistviewcall(string query, DataList g1)
 {
     fetch(query);
     g1.DataSource = ds.Tables[0];
     g1.DataBind();
 }
    public static void Process_Pagination(DataList _list, Repeater _rept, LinkButton _prev, LinkButton _next, int _size, int _pagenumber, IEnumerable _source)
    {
        PagedDataSource objPds = new PagedDataSource();
        objPds.DataSource = _source;
        objPds.AllowPaging = true;

        objPds.PageSize = _size;
        objPds.CurrentPageIndex = (_pagenumber - 1);

        if (!objPds.IsFirstPage)
            _prev.Visible = true;
        else
            _prev.Visible = false;
        if (!objPds.IsLastPage)
            _next.Visible = true;
        else
            _next.Visible = false;
        ArrayList arr = Return_Pagination_Link(objPds.PageCount, 11, _pagenumber);
        if (objPds.PageCount > 1)
        {
            _rept.Visible = true;
            _rept.DataSource = arr;
            _rept.DataBind();
        }
        else
        {
            _rept.Visible = false;
        }
        _list.DataSource = objPds;
        _list.DataBind();
    }
    public static void Process_Pagination(DataList _list, Repeater _rept, LinkButton _prev, LinkButton _next, int _size, int _pagenumber, IEnumerable _source, int _totalrecords)
    {
        int total_pages = (int)Math.Ceiling((double)_totalrecords / _size);
        if (total_pages > 1)
        {
            // Previous Link Scripting
            if (_pagenumber > 1)
            {
                _prev.Visible = true;
                int firstbound = (((_pagenumber - 1) - 1) * _size) + 1;
                if (firstbound < 0)
                    firstbound = 1;
                int lastbound = firstbound + _size - 1;
                _prev.ToolTip = "Showing " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
            }
            else
            {
                _prev.Visible = false;
            }
            // Next Link Scripting
            if (_pagenumber < total_pages)
            {
                _next.Visible = true;
                int firstbound = (((_pagenumber + 1) - 1) * _size) + 1;
                int lastbound = firstbound + _size - 1;
                if (lastbound > _totalrecords)
                    lastbound = _totalrecords;
                _next.ToolTip = "Showing " + firstbound + " - " + lastbound + " records of " + _totalrecords + " records";
            }
            else
            {
                _next.Visible = false;
            }

            // main pagination links
            ArrayList arr = Return_Pagination_Link_v2(total_pages, _pagenumber);
            _rept.Visible = true;
            _rept.DataSource = arr;
            _rept.DataBind();
        }
        else
        {
            _rept.Visible = false;
            _next.Visible = false;
            _prev.Visible = false;
        }

        _list.DataSource = _source;
        _list.DataBind();
    }