Hi,

im trying to set a row filter based one fixed paramater (locationID) and a second paramater on a session variable - im not an expert in C# at all, but i think what i have done should work? Can anyone see anything wrong / offer suggestions please? :)

try
        {

            connection.Open();

            string sqlStatement = "SELECT * FROM SI";

            SqlCommand sqlCmd = new SqlCommand(sqlStatement, connection);

            SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
            
            sqlDa.Fill(dt);
            
            string pID = Convert.ToString("Session[pageId]");
                       
            if (dt.Rows.Count > 0)
            {

                DataView dv = new DataView(dt); 
                dv.RowFilter = "locatID = 1, PageId =" + pID + "";
                GridView1.DataSource = dv;
                GridView1.DataBind();
                dv.RowFilter = "locatID = 2, PageId =" + pID + "";
                GridView2.DataSource = dv;
                GridView2.DataBind();
                dv.RowFilter = "locatID = 3, PageId =" + pID + "";
                GridView3.DataSource = dv;
                GridView3.DataBind();


            }

any help would be most appreciated :)

thanks

This article has been dead for over six months. Start a new discussion instead.