Custom pager in my Gridview 1st time works, next doesn't :
- by gre3ns0ul
Hi guys, i'm with one strange problem.
I am extending a control from a Gridview, and adding a dropdown to paging to the page i want.
In my custom gridview i added a ITemplate than contains 4 image buttons and one dropdownlist
(4 images - 1st, prev, next, last)
(1 ddl - to page)
and add him to my custom gridview..
I added a selectindexchange event to dropdown, to fire when a index is changed
The problem is:
The first time i load the page with my control it is really ok..
but when i change index, in debug i see to run constructor of control, creating footer template, and guess..
the method of indexchange isn't fired and returns an exception saying:
Unable to cast object of type 'System.Web.UI.WebControls.ImageButton' to type 'System.Web.UI.WebControls.Table'.
[InvalidCastException: Unable to cast object of type 'System.Web.UI.WebControls.ImageButton' to type 'System.Web.UI.WebControls.Table'.]
System.Web.UI.WebControls.GridView.PrepareControlHierarchy() +122
System.Web.UI.WebControls.GridView.Render(HtmlTextWriter writer, Boolean renderPanel) +50
System.Web.UI.WebControls.GridView.Render(HtmlTextWriter writer) +33
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
...
apreciate for the help,
thanks