GridView - Problem with Table.Rows.Remove( )

D

Dev

Hi,

I have a gridview from which i want to remove gridviewrows onfly.
I remove the rows as follows:

Dim oTable as Table = CType(oGridViewRow.Parent, Table)
oTable.Rows.Remove(CType(oGridViewRow, TableRow))

Above removes required rows from the gridview but the problem is on
postback, it adds blank rows again to the gridview. Is it because viewstate
is enabled? But it doesnt add all the deleted rows but always adds one less.

How can I control this, so that it will not add blank rows on postback?

[The gridview is not bound to any datasource controls. So it is not possible
to blankout databindings, delete a row from the datasource control and then
reset bindings too.]

Thanks.

Dev
 
D

Dev

Hi, further to this,

I know I can code the Gridview_PreRender( ) event to remove blank rows again
on a postback but is there any other better ways of accomplishing this? I
dont like this idea because I have to loop through the grid again on the
prerender event and delete blank rows. This will slow me down in case if my
grid is having many rows.

Dev
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,818
Messages
2,569,727
Members
45,675
Latest member
benn

Latest Threads

Top