hi all,
in my application i have a grid in which i display name of the persons basing on the login credentials, but i am getting all the names of all the persons in the database on the grid, i created a hidden field to which i assigned the session of the login credentials to the hidden field. but how can i write a query in markup(in datasource of the grid) to display the concern names in the grid can i assign the hiddenfield value to query. how can i assign the hidden field value to the query in markup,
query will be something like "select a,b,c from x where companyid=hiddenfieldvalue"
can any one help me please.
Loading
ThomasPosted Jun 8, 2012, 2:08 PM
string mysqlstring = "myField = '" + hiddenfield.text +"'";
DataRow[] GridRows = new DataRow[myDataSet.myTable.Select(mysqlstring, "NameOFSortField").Length];
GridRows = myDataSet.MyTable.Select(mysqlstring, "NameOFSortField");
foreach (DataRow row in GridRows)
{
myGridTable.ImportRow(row);
}
myGrid.DataSource = myGridTable;
This displays in the grid only the rows where the field in the table matches your username in the hidden text field