Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
i have a filtered data set that filter with dataview class. how i assign a cell of it to a textbox control. below is the code
C#
DataSet1 myset = new DataSet1();
DataSet1TableAdapters.testTableAdapter myadapter = new DataSet1TableAdapters.testTableAdapter();
myadapter.Fill(myset.test);
DataView myview = new DataView(myset.test);
myview.RowFilter =string.Format( "productname ='{0}'" , Request.QueryString["productname"].ToString() );


now, what can write in the following

What I have tried:

i tried to bind a textbox like textbox1 to a cell of filtered dataset for example "productname" field from first row
Posted
Updated 28-Jun-16 3:28am
v2

1 solution

You can do it like this:
C#
DataView myview = new DataView(myset.test);
myview.RowFilter =string.Format( "productname ='{0}'" , Request.QueryString["productname"].ToString() );
DataTable dt = myview.ToTable();


//Now you can use the dt object here to get the data
if(dt.Rows.Count > 0){
     TextBox1.Text = dt.Rows[0]["ColumnName"].ToString();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900