Mutliple dropdowns and values on the Paging
<p>I have a GridView and I populate it via a DATASET . Three of its columns are three DropDownLists and AllowPaging is set to true for the grid view. My problem is when I choose a value on anyone of the ddl and click on serach button i get the data on the gridview which will have paginig, but when  i click on the second page  i loose teh filtered calue onthe drop down and i again get the earlier dataset.</p>

<p>Is there any way/idea to persist the selected values? Thanks for your help.
Please can you help me with this. if i am not filtering anyone of teh dropdown and then clicking on the second or third page i get the relevant data of that particular page. teh only problem is when i have a value selected on the dropdown .</p>

<p>code:</p>

<p>button click:
    {
    string _strBU = BUDropDownList.SelectedValue;
    string _strOU = OUDropDownList.SelectedValue;</p>

<pre><code>string _strPortalID = !string.IsNullOrEmpty(TxtEmpPortalID.Text.Trim()) ?   TxtEmpPortalID.Text.Trim() : string.Empty;
string _strRU = RUDropDownList.SelectedValue;
string _strMngrPortalID = System.Web.HttpContext.Current.User.Identity.Name.ToString();
_strMngrPortalID = _strMngrPortalID.Substring(4, 6);

            SqlConnection sqlConnection = new SqlConnection();
            sqlConnection.ConnectionString = "server=;uid=;pwd=;database=HROrgchartDB";
            sqlConnection.Open();

            SqlCommand sqlEmployeeDetailsCommand = new SqlCommand();
            sqlEmployeeDetailsCommand.Connection = sqlConnection;
            sqlEmployeeDetailsCommand.CommandText = "EmployeeSearch";
            sqlEmployeeDetailsCommand.CommandType = CommandType.StoredProcedure;
            sqlEmployeeDetailsCommand.Parameters.Add(new SqlParameter("@BU", SqlDbType.VarChar, 50)).Value = _strBU;
            sqlEmployeeDetailsCommand.Parameters.Add(new SqlParameter("@OU", SqlDbType.VarChar, 50)).Value = _strOU;
            sqlEmployeeDetailsCommand.Parameters.Add(new SqlParameter("@PORTALID", SqlDbType.VarChar, 6)).Value = _strPortalID;
            sqlEmployeeDetailsCommand.Parameters.Add(new SqlParameter("@RU", SqlDbType.VarChar, 50)).Value = _strRU;
            sqlEmployeeDetailsCommand.Parameters.Add(new SqlParameter("@ManagerPortalID", SqlDbType.VarChar, 6)).Value = _strMngrPortalID;

            SqlDataAdapter da = new SqlDataAdapter(sqlEmployeeDetailsCommand);
            DataSet ds = new DataSet();
            da.Fill(ds);
            if (ds != null)
            {
                // gvAddorRelease.Visible = true;
                gridReportees.DataSource = ds;
                Cache["D2"] = ds;
                gridReportees.PageIndex = 0;
                gridReportees.DataBind();
            }
            else
            {


            }
            sqlConnection.Close();
        }
}
</code></pre>

<p>event for paging :</p>

<pre><code>gridReportees_PageIndexChanging:
{
gridReportees.PageIndex = e.NewPageIndex;
DataSet ds = new DataSet();
ds=(DataSet)Cache["D2"];
gridReportees.DataSource= ds;
gridReportees.DataBind();
}
</code></pre>
