Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: FIND BY METHODS IN DATASET TO QUERY & DISPLAY IN DATAGRID


Message #1 by "Vikas Jolly" <vikasjolly@y...> on Sat, 26 May 2001 12:18:30

Hi anyone



I have a DATASET and a  DATAGRID and a DROPDOWNLIST.



When a user selects one of the value from the DROPDOWNLIST, I want to get

all the records from a table by one of its field.(which this value of this

dropdownlist) and display it on the DATAGRID.



How will I achieve this? Is there any findBy methods ?



Here is how i do ?



{

QueryWebClient.localhost.WebService1 ws = new 

QueryWebClient.localhost.WebService1();

objPersonDataSet = ws.GetAllPersons();

DataSetView dsv = new DataSetView(objPersonDataSet);

String col = "person";

String query = "name = 'vikas'";

TableSetting ts = new TableSetting(objPersonDataSet.Tables

["person"],col,query,DataViewRowState.ModifiedCurrent);

Trace.Write("ts = ",""+ts.ToString());

dsv.TableSettings.Add(ts);

DataGrid1.DataSource = dsv;

DataGrid1.DataBind();

}





vikas
Message #2 by "Alex Homer" <alex@b...> on Tue, 29 May 2001 15:25:55
You can create a DataView based on the table in the DataSet and then set 

the RowFilter property to show only the rows you want:



DataView dsv = new DataView(objPersonDataSet.Tables[0]);

dsv.RowFilter = "name = 'vikas'";



Then bind the DataView to the DataGrid. 




  Return to Index