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
-----------------------------------------


.



Relevant Pages

  • Re: ObjectDataSource in ASP.NET 2.0
    ... > property so as to make the primary key field readonly or invisible. ... > event we define the following gridView template schema: ... > update event of the GridView or DataSource control. ... > |> Microsoft Online Support ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: How to modify SqlDataAdapter field prior to render in GridView
    ... Method #2 worked real well for the GridView control. ... We can also do the manipulation at databound control level. ... How to modify SqlDataAdapter field prior to render in GridView? ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: GridView UserControl Problems
    ... If the final GridView structure is decided upon based on the data that is ... I have designed a UserControl for each different type of input. ... the DropDownList control. ... In the main page, I use the GridView's RowDataBound event, (fired once ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: GridViewRow FindControl failing
    ... You can definitely do this from some of the gridview events such as ... GridViewRow selectRow = MyGridView.SelectedRow; ... it resides as a direct child of the control you are finding from. ... Dim sManagerTypeCode = r.Cells.Text ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: TableRows and Postback
    ... //always register this hidden field with the previous value. ... This GridView control has an extra column ... > Protected Sub Page_Load(ByVal sender As Object, ...
    (microsoft.public.dotnet.framework.aspnet)

Loading