Пример #1
0
 private void Datalistshow()
 {
     DataTable dt = (DataTable)Session["SelectedRecords"];
     Datalist1.DataSource = dt;
     Datalist1.DataBind();
     //pgsource.AllowPaging = true;
 }
Пример #2
0
 private void Datalistclear()
 {
     Datalist1.DataSource = null;
     Datalist1.DataBind();
     //Session["SelectedRecords"] = "";
     //Session["page"] = "";
 }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable table = new DataTable();

            table.Columns.Add("FirstName");
            table.Columns.Add("LastName");
            table.Columns.Add("Designation");
            table.Columns.Add("Location");
            table.Columns.Add("Country");


            table.Rows.Add("Aishwarya", "Jadhav", "Software Engineer", "Solapur", "India");
            table.Rows.Add("Asmita", "Jadhav", "HR", "Mumbai", "India");
            table.Rows.Add("Varsha", "Aainure", "Manager", "Pune", "India");
            table.Rows.Add("Aasharani", "Waghmode", "intern", "Hyderbad", "India");
            table.Rows.Add("Manasi", "Wabhuvan", "Software Engineer", "Bangalore", "India");
            table.Rows.Add("Rai", "Patil", "HR", "Solapur", "India");
            table.Rows.Add("Aarti", "Nishandar", "Software Engineer", "Kalkatta", "India");
            table.Rows.Add("Priyanka", "Raikar", "Manager", "Chennai", "India");
            table.Rows.Add("Vaishnavi", "Chdachnakar", "Software Engineer", "Chennai", "India");
            table.Rows.Add("Shivani", "Darekar", "Software Engineer", "Solapur", "India");


            Datalist1.DataSource = table;
            Datalist1.DataBind();
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UrunID = Request.QueryString["UrunID"];


            SqlCommand    cmuGetir = new SqlCommand("Select * from Urun where UrunID='" + UrunID + "'", baglan.baglan());
            SqlDataReader druGetir = cmuGetir.ExecuteReader();

            Datalist1.DataSource = druGetir;
            Datalist1.DataBind();
            if (Session["KoleksiyonerEmail"] != null)
            {
                string        kEmail     = Session["KoleksiyonerEmail"].ToString();
                SqlCommand    cmdSession = new SqlCommand("Select * from Koleksiyoner where KoleksiyonerEmail='" + kEmail + "'", baglan.baglan());
                SqlDataReader drSession  = cmdSession.ExecuteReader();
                DatalistProfilBilgi.DataSource = drSession;
                DatalistProfilBilgi.DataBind();
                Panel1.Visible = false;
                //SqlCommand cmYorumGetir = new SqlCommand("Select * from ForumKonuYorum where ForumKonuID=" + ForumKonuID + "", baglan.baglan());
                //SqlDataReader drYorumGetir = cmYorumGetir.ExecuteReader();
                //DatalistMesajGetir.DataSource = drYorumGetir;
                //DatalistMesajGetir.DataBind();
            }
            else
            {
                Panel2.Visible = false;
            }
        }
Пример #5
0
    public void getdata()
    {
        string        conn = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
        SqlConnection con  = new SqlConnection(conn);

        con.Open();
        String         s  = "Select * from Product";
        SqlDataAdapter da = new SqlDataAdapter(s, con);
        DataSet        ds = new DataSet();

        da.Fill(ds);
        PagedDataSource ad = new PagedDataSource();

        ad.DataSource        = ds.Tables[0].DefaultView;
        ad.AllowPaging       = true;
        ad.PageSize          = 6;
        ad.CurrentPageIndex  = pos;
        Button5.Enabled      = !ad.IsFirstPage;
        Button6.Enabled      = !ad.IsLastPage;
        Button5.Visible      = !ad.IsFirstPage;
        Button6.Visible      = !ad.IsLastPage;
        Datalist1.DataSource = ad;
        Datalist1.DataBind();
        da.Dispose();
        con.Close();
    }
    public void getdata()
    {
        string        conn = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
        SqlConnection con  = new SqlConnection(conn);

        con.Open();
        int        i   = 1;
        String     s   = "Select * from Members where IOT=@IOT";
        SqlCommand cmd = new SqlCommand(s, con);

        cmd.Parameters.AddWithValue("IOT", i);
        cmd.ExecuteNonQuery();
        SqlDataAdapter da = new SqlDataAdapter();

        da.SelectCommand = cmd;
        DataSet ds = new DataSet();

        da.Fill(ds);
        Datalist1.DataSource = ds;
        Datalist1.DataBind();
        da.Dispose();
        this.textbox1.Value = "*****@*****.**";
        this.textbox2.Value = "Indraneel";
        this.textbox3.Value = "Pal";
        this.textbox4.Value = "9830762671";
    }
Пример #7
0
    private void Datalistshow()
    {
        DataTable dt = (DataTable)Session["SelectedRecords"];

        Datalist1.DataSource = dt;
        Datalist1.DataBind();

        //DataSet ds = (DataSet)Session["SelectedRecords"];
        //Datalist1.DataSource = ds;
        //Datalist1.DataBind();
    }
Пример #8
0
    public string BindQuestions(string tid)
    {
        string duration = string.Empty;

        if (tid != "")
        {
            ParameterCollection obParam = new ParameterCollection();

            obParam.Add("@testid", tid);

            obDs = dal.fnRetriveByPro("GetQuestionsAndAnwersBytest", obParam);

            if (obDs.Tables.Count > 0)
            {
                if (obDs.Tables[0].Rows.Count > 0)
                {
                    totalrows = obDs.Tables[0].Rows.Count;
                    duration  = obDs.Tables[0].Rows[0]["testduration"].ToString();
                    PagedDataSource objPds;

                    // Populate the repeater control with the DataSet at page init or pageload
                    objPds            = new PagedDataSource();
                    objPds.DataSource = obDs.Tables[0].DefaultView;

                    // Indicate that the data should be paged
                    objPds.AllowPaging      = true;
                    objPds.CurrentPageIndex = currentposition;
                    string qid = obDs.Tables[0].Rows[currentposition]["qid"].ToString();
                    BindAnsList(qid);
                    // Set the number of items you wish to display per page
                    objPds.PageSize = 1;

                    btnfirst.Enabled     = !objPds.IsFirstPage; //1
                    btnnext.Enabled      = !objPds.IsLastPage;  //2
                    btnprevious.Enabled  = !objPds.IsFirstPage; //3
                    btnlast.Enabled      = !objPds.IsLastPage;  //4
                    Datalist1.DataSource = objPds;
                    Datalist1.DataBind();
                }
            }
        }
        return(duration);
    }
    public void BindAllTestByUser(string userid)
    {
        ParameterCollection obParam = new ParameterCollection();

        obParam.Add("@userid", userid);
        //obDs = dal.fnRetriveByPro("BindAlltestByuser", obParam); // old
        obDs = dal.fnRetriveByPro("BindAlltest", obParam);  //new
        if (obDs.Tables.Count > 0)
        {
            DataTable dt = obDs.Tables[0];

            if (dt.Rows.Count > 0)
            {
                Datalist1.DataSource = dt;
                //Datalist1.DataSource = Get(userid);
                Datalist1.DataBind();
            }
        }
    }
Пример #10
0
        protected void LinkButton1_Click1(object sender, EventArgs e)
        {
            SqlConnection     con     = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["myconstr"].ConnectionString);
            SqlDataAdapter    da      = new SqlDataAdapter("select * from Post_Comments", con);
            SqlCommandBuilder builder = new SqlCommandBuilder(da);
            DataSet           ds      = new DataSet();

            da.Fill(ds, "post_comments");
            DataRow row = ds.Tables[0].NewRow();

            row["PostId"]  = Request.QueryString["postid"];
            row["email"]   = Session["userid"].ToString();
            row["comment"] = comments;
            row["date"]    = DateTime.Now.ToString();

            ds.Tables[0].Rows.Add(row);

            da.Update(ds, "post_comments");
            comments = "";
            Datalist1.DataBind();
        }
Пример #11
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        string        conn = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
        SqlConnection con  = new SqlConnection(conn);

        con.Open();
        String     s   = "Select * from Product where (product_name like '%'+ @name +'%')";
        SqlCommand cmd = new SqlCommand(s, con);

        cmd.Parameters.AddWithValue("@name", SqlDbType.NVarChar).Value = TextBox1.Text;
        cmd.ExecuteNonQuery();
        SqlDataAdapter da = new SqlDataAdapter();

        da.SelectCommand = cmd;
        DataSet ds = new DataSet();

        da.Fill(ds, "product_name");
        Datalist1.DataSource = ds;
        Datalist1.DataBind();
        con.Close();
    }
Пример #12
0
    public void getdata()
    {
        string        conn = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
        SqlConnection con  = new SqlConnection(conn);

        con.Open();
        int        i   = 1;
        String     s   = "Select * from Members where Circuistic IS NOT NULL";
        SqlCommand cmd = new SqlCommand(s, con);

        cmd.ExecuteNonQuery();
        SqlDataAdapter da = new SqlDataAdapter();

        da.SelectCommand = cmd;
        DataSet ds = new DataSet();

        da.Fill(ds);
        Datalist1.DataSource = ds;
        Datalist1.DataBind();
        da.Dispose();
    }
Пример #13
0
    public void getdata()
    {
        string        conn = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
        SqlConnection con  = new SqlConnection(conn);

        con.Open();
        int        i   = 1;
        String     s   = "Select * from Members where Photography=@Photography";
        SqlCommand cmd = new SqlCommand(s, con);

        cmd.Parameters.AddWithValue("Photography", i);
        cmd.ExecuteNonQuery();
        SqlDataAdapter da = new SqlDataAdapter();

        da.SelectCommand = cmd;
        DataSet ds = new DataSet();

        da.Fill(ds);
        Datalist1.DataSource = ds;
        Datalist1.DataBind();
        da.Dispose();
    }
    private void bindGridView()
    {
        #region 绑定Gridview
        con.ConnectionString = "provider=Microsoft.ACE.OLEDB.12.0;data source=" + Server.MapPath("app_data/gaokao.accdb");
        con.Open();
        cmd.Connection  = con;
        cmd.CommandText = "select * from exam_li01";

        if (classes != null && stunum != null)
        {
            cmd.CommandText += " where class = '" + classes + "' and stunum = " + stunum;
        }
        else
        {
            cmd.CommandText += " where class = '1' and stunum = 1";
        }
        da = new OleDbDataAdapter(cmd);
        da.Fill(dt);
        Datalist1.DataSource = dt;
        Datalist1.DataBind();
        stuname = dt.Rows[0]["stuname"].ToString();
        #endregion
    }
Пример #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = "Tin tuc online | tin tuc 24h | tin moi nhat";

        if (!IsPostBack)
        {
            Page.Title           = "Tin tuc online | tin tuc 24h | tin moi nhat";
            Page.MetaDescription = "";
            Page.MetaKeywords    = "";
            Datalist1.DataSource = data.GetAllBaiVietLimitOffSet(1, 0);
            Datalist1.DataBind();
            Datalist2.DataSource = data.GetAllBaiVietLimitOffSet(6, 1);
            Datalist2.DataBind();
            dataCongnghe1.DataSource = data.GetAllBaiVietLimitOffSet(1, 0);
            dataCongnghe1.DataBind();
            dataCongnghe2.DataSource = data.GetAllBaiVietLimitOffSet(3, 1);
            dataCongnghe2.DataBind();
            //
            dataANXH1.DataSource = data.GetBaiVietTheoChuyenMucLimitOffset(9, 1, 0);
            dataANXH1.DataBind();
            dataANXH2.DataSource = data.GetBaiVietTheoChuyenMucLimitOffset(9, 3, 0);
            dataANXH2.DataBind();
            //
            dataBongda1.DataSource = data.GetBaiVietTheoChuyenMucLimitOffset(5, 1, 0);
            dataBongda1.DataBind();
            dataBongda2.DataSource = data.GetBaiVietTheoChuyenMucLimitOffset(5, 3, 0);
            dataBongda2.DataBind();
            //
            dataTG.DataSource = data.GetBaiVietTheoChuyenMucLimitOffset(1, 3, 0);
            dataTG.DataBind();
            //
            dataDulich1.DataSource = data.GetBaiVietTheoChuyenMucLimitOffset(10, 1, 0);
            dataDulich1.DataBind();
            dataDulich2.DataSource = data.GetBaiVietTheoChuyenMucLimitOffset(10, 3, 0);
            dataDulich2.DataBind();
        }
    }
Пример #16
0
    protected void Button4_Click(object sender, EventArgs e)
    {
        this.TextBox1.Text = "";
        string        conn = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
        SqlConnection con  = new SqlConnection(conn);

        con.Open();
        int        i   = this.DropDownList1.SelectedIndex + 1;
        String     s   = "Select * from Product where category_id=@category_id";
        SqlCommand cmd = new SqlCommand(s, con);

        cmd.Parameters.AddWithValue("category_id", i);
        cmd.ExecuteNonQuery();
        SqlDataAdapter da = new SqlDataAdapter();

        da.SelectCommand = cmd;
        DataSet ds = new DataSet();

        da.Fill(ds);
        Datalist1.DataSource = ds;
        Datalist1.DataBind();
        da.Dispose();
        con.Close();
    }
Пример #17
0
 private void Datalistclear()
 {
     Datalist1.DataSource = null;
     Datalist1.DataBind();
 }
Пример #18
0
    public DataTable BindQuestionsInitialy(string tid)
    {
        currentposition = 0;
        DataTable dt       = new DataTable();
        string    duration = string.Empty;

        if (tid != "")
        {
            ParameterCollection obParam = new ParameterCollection();

            obParam.Add("@testid", tid);

            obDs = dal.fnRetriveByPro("GetQuestionsAndAnwersBytest", obParam);
            dt   = obDs.Tables[0];
            if (obDs.Tables.Count > 0)
            {
                if (obDs.Tables[0].Rows.Count > 0)
                {
                    #region creating datatable
                    DataTable dtResultMaintain = new DataTable();
                    //Add Columns to datatable
                    dtResultMaintain.Columns.Add("Row_Number", typeof(Int32));
                    dtResultMaintain.Columns.Add("Userid", typeof(string));
                    dtResultMaintain.Columns.Add("Testid", typeof(string));
                    dtResultMaintain.Columns.Add("Qid", typeof(Int32));
                    dtResultMaintain.Columns.Add("Ansid", typeof(Int32));
                    dtResultMaintain.Columns.Add("IsSeen", typeof(Boolean));
                    dtResultMaintain.Columns.Add("IsAttempted", typeof(Boolean));
                    dtResultMaintain.Columns.Add("CorrectAnsid", typeof(Int32));

                    //Adding rows and data
                    for (int i = 0; i < obDs.Tables[0].Rows.Count; i++)
                    {
                        dal.fnExecuteNonQuery("insert into ResultMaintain ([Userid],[Testid],[Qid],[Ansid],[IsSeen],[IsAttempted],[CorrectAnsid],[TestStartDatetime],[TestDuration]) VALUES ('" + userid + "','" + tid + "','" + obDs.Tables[0].Rows[i]["qid"].ToString() + "',null,0,0,'" + obDs.Tables[0].Rows[i]["Ansid"].ToString() + "',getdate(),'" + obDs.Tables[0].Rows[0]["testduration"].ToString() + "')");
                        dtResultMaintain.Rows.Add(Convert.ToInt32(obDs.Tables[0].Rows[i]["Row_Number"]), userid, tid, Convert.ToInt32(obDs.Tables[0].Rows[i]["qid"]), 0, 0, 0, Convert.ToInt32(obDs.Tables[0].Rows[i]["Ansid"]));
                    }
                    #endregion

                    Session["TestDetails"] = dtResultMaintain;


                    dt        = obDs.Tables[0];
                    totalrows = obDs.Tables[0].Rows.Count;
                    duration  = obDs.Tables[0].Rows[0]["testduration"].ToString();
                    PagedDataSource objPds;

                    // Populate the repeater control with the DataSet at page init or pageload
                    objPds            = new PagedDataSource();
                    objPds.DataSource = obDs.Tables[0].DefaultView;

                    // Indicate that the data should be paged
                    objPds.AllowPaging      = true;
                    objPds.CurrentPageIndex = currentposition;
                    string qid = obDs.Tables[0].Rows[currentposition]["qid"].ToString();
                    BindAnsList(qid);
                    // Set the number of items you wish to display per page
                    objPds.PageSize = 1;

                    btnfirst.Enabled     = !objPds.IsFirstPage; //1
                    btnnext.Enabled      = !objPds.IsLastPage;  //2
                    btnprevious.Enabled  = !objPds.IsFirstPage; //3
                    btnlast.Enabled      = !objPds.IsLastPage;  //4
                    Datalist1.DataSource = objPds;
                    Datalist1.DataBind();
                }
            }
        }
        return(dt);
    }