filterdata using rowfilter expression

  • Thread starter Thread starter DotNetJunkies User
  • Start date Start date
D

DotNetJunkies User

Hi

I am trying to filter data using the rowfilter expression. However I want to pass a string variable eg

string sname = txtlastname.Text;

string ln = "LastName = 'sname'";
dataView1.RowFilter=ln; DataGrid1.DataSource=dataView1;
DataGrid1.DataBind();

when I run this, nothing happens to the datagrid

Please help
 
Perhaps, you wanted to append the value of variable sname to the filter
criteria?

string ln = "LastName = "' + sname + "'";

Hi

I am trying to filter data using the rowfilter expression. However I want
to pass a string variable eg

string sname = txtlastname.Text;

string ln = "LastName = 'sname'";
dataView1.RowFilter=ln; DataGrid1.DataSource=dataView1;
DataGrid1.DataBind();

when I run this, nothing happens to the datagrid

Please help
 
Back
Top