I tried to filter a row selection from gridview1 into gridview2, however the output in gridview2 is the listing of the table without any filter.
The codes are as follows
string str1;
str1 = ConfigurationManager.ConnectionStrings["WEBHR"].ConnectionString;
SqlConnection sqlcon1 = new SqlConnection(str1);
string intno7, intno8;
intno7 = txt_Code.Text;
intno8 = txt_Year.Text;
SqlCommand SqlCmd1 = new SqlCommand("sp_GetLeavGrid2year", sqlcon1);
SqlCmd1.CommandType = System.Data.CommandType.StoredProcedure;
SqlCmd1.Parameters.AddWithValue("@BRNNO", intno7);
SqlCmd1.Parameters.AddWithValue("@BYEAR", intno8);
SqlCmd1.Parameters.Add("@BEMPNO", System.Data.SqlDbType.VarChar, 50);
SqlCmd1.Parameters["@BEMPNO"].Direction = System.Data.ParameterDirection.Output;
SqlCmd1.Parameters.Add("@BRETURNDATE", System.Data.SqlDbType.VarChar, 50);
SqlCmd1.Parameters["@BRETURNDATE"].Direction = System.Data.ParameterDirection.Output;
SqlCmd1.Parameters.Add("@BIDCNT", System.Data.SqlDbType.VarChar, 50);
SqlCmd1.Parameters["@BIDCNT"].Direction = System.Data.ParameterDirection.Output;
sqlcon1.Open();
SqlCmd1.ExecuteNonQuery();
txt_idcnt.Text = SqlCmd1.Parameters["@BIDCNT"].Value.ToString();
txt_Code.Text = SqlCmd1.Parameters["@BRNNO"].Value.ToString();
txt_Empno.Text = SqlCmd1.Parameters["@BEMPNO"].Value.ToString();
txt_Return_Date.Text = SqlCmd1.Parameters["@BRETURNDATE"].Value.ToString();
txt_Year.Text = SqlCmd1.Parameters["@BYEAR"].Value.ToString();
SqlDataAdapter dm = new SqlDataAdapter("Select * from curasch where idno='" + txt_Code.Text + "' and year1='" + txt_Year.Text + "'", sqlcon1);
DataSet df = new DataSet();
dm.Fill(df,"Curasch");
GridView2.DataSource = df.Tables[0];
GridView2.DataBind();
txt_Empno.Focus();
LoadTransactionSearch();
lblstatus.Text = "///Grid2 record successful";
lblstatus.Text = "///Grid2View record successful";
sqlcon1.Close();
Because the filter wasn't working I tried an alternative, however the filter is still not working.
Please assist me to rectify this issue.
Thanks
What I have tried:
I have checked the net for similar example, however i couldn't find any.