dynamic grid

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

On my web page i want to run 2 queries depending what is selected in the
drop downs, but I also want a data item to be added to my grid.

Example:
query 1 runs when a name is selected and the user clicks go - where =
selectitem.value
query 2 runs when the user selects the word ALL in the drop down - no
where clause shows all records from the DB

I also want to add a data item in the grid when ALL is selected and not
show the item when a individual is selected. I can do it with "classic asp"
but how can i do it with VB.NET - asp.net

thx
 
Mike

This is how I normally do it

At design time add columns to your datagrid. At runtime depending on which query you are executing you can remove the specific column from the datagrid by executing the following line

grdTest.Columns.RemoveAt(5);

( Where 5 is the column you would like to remove). Please note here that if you need to remove two columns, you can't say RemoveAt(5) and RemoveAt(6), because on line execution it changes the column count. so you will have to consider the index of a column when removing it

When you execute the query with more columns, you won't delete the column

Hope it works for you

Thanks

Ta
 
Back
Top