Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview
- From: "Dev" <dev@xxxxxxxxxxxxx>
- Date: Wed, 9 May 2007 17:50:42 +0600
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)" <gaurav.vaish.nospam@xxxxxxxxxxxxxxxx>
wrote in message news:uYbZ6kikHHA.4248@xxxxxxxxxxxxxxxxxxxxxxx
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
-----------------------------------------
.
- Follow-Ups:
- Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview
- From: MasterGaurav \(www.edujini-labs.com\)
- Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview
- References:
- Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview
- From: Dev
- Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview
- From: MasterGaurav \(www.edujini-labs.com\)
- Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview
- Prev by Date: Re: grid cell has onclick but hand is not shown
- Next by Date: Re: Key in Dictionary
- Previous by thread: Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview
- Next by thread: Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview
- Index(es):
Relevant Pages
|
Loading