2
Answers

Hiding table row in C#

Ayyub  Khan

Ayyub Khan

13y
4.8k
1
HI all,

I getting an issue here...i have created on table table and in that table i m adding a row using table.Row.Add(rowname)....now in that row im adding cells using for loop...Now issue is that if i want to hide any of the row by checking the condition of cell.text.....what to do can anyone help??

Any help would be appriciated....

Note:Table is creating dynamically and have to hide or show on checkbox's checked or unchecked condition.....

Answers (2)
0
Pravin More

Pravin More

NA 2.6k 136.1k 13y
Hi Ayyub,

  You can try 1 simple way... write  simple Linq query on table like below.....depending on value selected in combobox

  string combovalue=combobox1.SelectedValue();
  var result = (from DataRow trow in table.Rows select trow).Except(from DataRow trow1 in table.Rows where col1=combovalue select trow);




it will work i think,
Thanks,
Pravin.

0
Sam Hobbs

Sam Hobbs

NA 28.7k 1.3m 13y
I do not know what you mean when you say hide, if you need to hide from SQL Server a row in a table. Hiding a row in a table is not done; you cannot hide a row from SQL Server or from a program that queries the table. What you can do is to make a column in the table that specifies whether a row should be invisible in certain conditions and then make a view that selects just the rows that are not invisible.

If you actually mean that you need to hide a row in a grid that shows the data, then please clarify what you mean.