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: Sat, 5 May 2007 13:23:02 +0600,    posted on: microsoft.public.dotnet.framework.aspnet.datagridcontrol        back       

Thread Index
  1    Dev
          2    Eliyahu Goldin
                 3    Dev
          4    MasterGaurav \(www.edujini-labs.com\)
                 5    Dev
                        6    MasterGaurav \(www.edujini-labs.com\)


Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview   
Hi,

I'm removing rows from a gridview using Table.Remove( ). This removes the 
rows from the gridview.
But the problem is although it removes rows from the gridview it doesnt 
update the Gridview.Rows.Count to return correct number of rows remains on 
the gridview. Instead it always returns the number of rows gridview 
originally had prior to removing them.

Anybody know why this is happening? How to remove gridview rows in a manner 
so that it will update the rows.count property correctly?

Note: I'm looking for a method to directly remove rows from a gridview 
without having to rebinding gridview to datasource controls etc...

Dev
Date:Sat, 5 May 2007 13:23:02 +0600   Author:  

Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview   
What is Table.Remove()? What class is Table? How is it related to the grid?

-- 
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Dev"  wrote in message 
news:eMKUAZujHHA.1388@TK2MSFTNGP05.phx.gbl...

> Hi,
>
> I'm removing rows from a gridview using Table.Remove( ). This removes the 
> rows from the gridview.
> But the problem is although it removes rows from the gridview it doesnt 
> update the Gridview.Rows.Count to return correct number of rows remains on 
> the gridview. Instead it always returns the number of rows gridview 
> originally had prior to removing them.
>
> Anybody know why this is happening? How to remove gridview rows in a 
> manner so that it will update the rows.count property correctly?
>
> Note: I'm looking for a method to directly remove rows from a gridview 
> without having to rebinding gridview to datasource controls etc...
>
> Dev
> 
Date:Sun, 6 May 2007 12:15:03 +0300   Author:  

Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview   
Hi Goldin,

Just check the object returned by Gridview.controls(0). This is a Childtable 
which you can typecast to Table.
Using this you can add new rows, delete rows (as I've mentioned) in a 
gridview directly. Let me know if u figure out how to overcome the problem 
I've mentioned below.

Dev

"Eliyahu Goldin"  wrote in 
message news:eOS1J87jHHA.4040@TK2MSFTNGP03.phx.gbl...

> What is Table.Remove()? What class is Table? How is it related to the 
> grid?
>
> -- 
> Eliyahu Goldin,
> Software Developer & Consultant
> Microsoft MVP [ASP.NET]
> http://msmvps.com/blogs/egoldin
> http://usableasp.net
>
>
> "Dev"  wrote in message 
> news:eMKUAZujHHA.1388@TK2MSFTNGP05.phx.gbl...
>> Hi,
>>
>> I'm removing rows from a gridview using Table.Remove( ). This removes the 
>> rows from the gridview.
>> But the problem is although it removes rows from the gridview it doesnt 
>> update the Gridview.Rows.Count to return correct number of rows remains 
>> on the gridview. Instead it always returns the number of rows gridview 
>> originally had prior to removing them.
>>
>> Anybody know why this is happening? How to remove gridview rows in a 
>> manner so that it will update the rows.count property correctly?
>>
>> Note: I'm looking for a method to directly remove rows from a gridview 
>> without having to rebinding gridview to datasource controls etc...
>>
>> Dev
>>
>
> 
Date:Mon, 7 May 2007 15:31:43 +0600   Author:  

Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview   

> I'm removing rows from a gridview using Table.Remove( ). This removes the 
> rows from the gridview.
> But the problem is although it removes rows from the gridview it doesnt 
> update the Gridview.Rows.Count to return correct number of rows remains on 
> the gridview. Instead it always returns the number of rows gridview 
> originally had prior to removing them.
>
> Anybody know why this is happening? How to remove gridview rows in a 
> manner so that it will update the rows.count property correctly?


That's not the way of removing rows.
Gridview.Rows.Count does not return Table.Rows.Count!

Gridview.Rows.Count is for the DataSource's row-count.
Well, you cannot control the items that will be pushed in the grid if you 
cannot control the data-source.

If you want to remove any item, ensure that you also remove it from the 
datasource to which you are binding the gridview.


-- 
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Date:Wed, 9 May 2007 13:05:37 +0530   Author:  

Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview   
Hi Gaurav,

Thanks. I'm trying to do this in ASP.net and gridview is bount to a 
datatable. I dont need to use a datasource control in this case as I'm not 
trying to delete any rows from the database.

How to remove rows from the source datatable on postback?

Do I have to access database on postback, recreate the datatable without the 
rows I want to get rid off and bind the datatable to the gridview is it? If 
so it doesnt sound a good method for me as I dont want to access the 
database unnecessarily.

Any ideas?

Dev

"MasterGaurav (www.edujini-labs.com)"  
wrote in message news:uYbZ6kikHHA.4248@TK2MSFTNGP06.phx.gbl...

>> I'm removing rows from a gridview using Table.Remove( ). This removes the 
>> rows from the gridview.
>> But the problem is although it removes rows from the gridview it doesnt 
>> update the Gridview.Rows.Count to return correct number of rows remains 
>> on the gridview. Instead it always returns the number of rows gridview 
>> originally had prior to removing them.
>>
>> Anybody know why this is happening? How to remove gridview rows in a 
>> manner so that it will update the rows.count property correctly?
>
> That's not the way of removing rows.
> Gridview.Rows.Count does not return Table.Rows.Count!
>
> Gridview.Rows.Count is for the DataSource's row-count.
> Well, you cannot control the items that will be pushed in the grid if you 
> cannot control the data-source.
>
> If you want to remove any item, ensure that you also remove it from the 
> datasource to which you are binding the gridview.
>
>
> -- 
> Happy Hacking,
> Gaurav Vaish | www.mastergaurav.com
> www.edujini-labs.com
> http://eduzine.edujini-labs.com
> -----------------------------------------
>
> 
Date:Wed, 9 May 2007 17:50:42 +0600   Author:  

Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview   

> Thanks. I'm trying to do this in ASP.net and gridview is bount to a 
> datatable. I dont need to use a datasource control in this case as I'm not 
> trying to delete any rows from the database.
>
> How to remove rows from the source datatable on postback?


You may bind the datagrid to DataView with a "Filter" with appropriate 
"SortColumn".

DataView will not modify the underlying table but at the same time will be 
able to "Filter" the data to be given to the grid.


-- 
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Date:Thu, 31 May 2007 17:31:56 +0530   Author:  

Google
 
Web dotnetnewsgroup.com


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