コード例 #1
0
        public void Grid_Bind()
        {
            GridUserCred.DataSource = null;
            GridUserCred.DataBind();
            SqlDataAdapter sda;
            DataTable      dt = new DataTable();

            sda = new SqlDataAdapter(query, con);
            sda.Fill(dt);

            if (dt.Rows.Count > 0)
            {
                GridUserCred.DataSource = dt;
                GridUserCred.DataBind();
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "Key", "<script>MakeStaticHeader('" + GridUserCred.ClientID + "', 750, 100 , 100 ,false); </script>", false);
            }
        }
コード例 #2
0
        protected void btnSeacrchDate_Click(object sender, EventArgs e)
        {
            DateTime dos        = DateTime.Parse(txtDate.Text.Trim());
            string   searchdate = dos.ToString("dd/MM/yyyy");

            GridUserCred.DataSource = null;
            GridUserCred.DataBind();
            SqlDataAdapter sda;
            DataTable      dt = new DataTable();

            query = query + "  where convert(date,[loginDate],105)=convert(date,'" + searchdate + "',105)";
            sda   = new SqlDataAdapter(query, con);
            sda.Fill(dt);

            if (dt.Rows.Count > 0)
            {
                GridUserCred.DataSource = dt;
                GridUserCred.DataBind();
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "Key", "<script>MakeStaticHeader('" + GridUserCred.ClientID + "', 750, 100 , 100 ,false); </script>", false);
            }
        }