DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 2 May 2007 17:31:17 +0600,    posted on: microsoft.public.dotnet.framework.aspnet.datagridcontrol        back       

Thread Index
  1    Dev
          2    Dev


GridView - Problem with Table.Rows.Remove( )   
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
Date:Wed, 2 May 2007 17:31:17 +0600   Author:  

Re: GridView - Problem with Table.Rows.Remove( )   
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"  wrote in message 
news:ebGHt1KjHHA.3120@TK2MSFTNGP05.phx.gbl...

> 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
>
>
> 
Date:Wed, 2 May 2007 18:16:33 +0600   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us