hello,
How to display this month data in GridView only
So if this month Auq
show only this month other data hide
public partial class manager : System.Web.UI.Page
{
int lastRowIndex = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
BindGrid();
txtBoxDate2.Text = DateTime.Now.ToString("hh\\:mm");
txtBoxDate.Text = DateTime.Now.ToString("yyyy/MM/dd");
}
}
private void BindGrid()
{
string constr = ConfigurationManager.ConnectionStrings["kankonConnectionString"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("Manager_boss"))
{
cmd.Parameters.AddWithValue("@Action", "SELECT");
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
con.Close();
}
foreach (GridViewRow grv in GridView1.Rows)
{
if (grv.RowType == DataControlRowType.DataRow)
{
if (grv.RowIndex > lastRowIndex)
{
lastRowIndex = grv.RowIndex;
}
}
}
GridView1.Rows[lastRowIndex].BackColor = System.Drawing.Color.AliceBlue;
}
}
}
}
Query in procedure
SELECT Id, date, metting, location, whiwhois, time, note FROM Manager