I use a gridview for two bindings in asp.net.
There are plenty of images in each of these bindings.
I want to page the gridview.
I only know how to use single BindGrid, but in my case they are double.
What code should I use in the "protected void gvImages_PageIndexChanging" method?
protected void ddlName1_SelectedIndexChanged(object sender, EventArgs e)
{
BindGrid1();
}
protected void ddlName2_SelectedIndexChanged(object sender, EventArgs e)
{
BindGrid2();
}
private void BindGrid1()
{
MySqlConnection con = new MySqlConnection(constr);
MySqlCommand cmd = new MySqlCommand("SELECT * FROM rasmlar where Rasm_ID in ('" + String.Join("','", getImage_ID1().ToArray()) + "')", con);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
gvImages.DataSource = dt;
gvImages.DataBind();
}
private void BindGrid2()
{
MySqlConnection con = new MySqlConnection(constr);
MySqlCommand cmd = new MySqlCommand("SELECT * FROM rasmlar where Rasm_ID in ('" + String.Join("','", getImage_ID2().ToArray()) + "')", con);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
gvImages.DataSource = dt;
gvImages.DataBind();
}
protected void gvImages_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvImages.PageIndex = e.NewPageIndex;
}