Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > GridView - Problem with Table.Rows.Remove( )

Reply
Thread Tools

GridView - Problem with Table.Rows.Remove( )

 
 
Dev
Guest
Posts: n/a
 
      05-02-2007
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



 
Reply With Quote
 
 
 
 
Dev
Guest
Posts: n/a
 
      05-02-2007
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

"Dev" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gridview inside gridview problem Vik ASP .Net 1 05-11-2009 10:07 PM
GridView RowCommand problem: GridView Nested in Repeater HeavyMetal ASP .Net Web Controls 0 08-08-2006 01:17 PM
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
GridView in a GridView Nalaka ASP .Net 6 12-05-2005 05:48 PM
Gridview with combobox whose data is dependent on field in gridview wallermj@hotmail.com ASP .Net 3 11-21-2005 05:34 PM



Advertisments