We help IT Professionals succeed at work.

Datagrid events dont fire

kpankaj9 asked
Last Modified: 2012-06-27
I have created a datagrid dynamically,the grid displays perfect...except that events dont fire. First time when the page loads ItemCreated and ItemDataBound events dont fire, When I click on any sort expession ,now I could see(using brakepoints) the events the firing..but here also after the code is executed neither sorting in the header column is performed nor totals are displyed in the footer. I tried almost everything ..like placing the event handlers,CreateGrid method in IntializeComponent() and everything I could find on net.Can anybody pls help??
Watch Question

Check the following article:

Creating DataGrid BoundColumn ButtonColumn HyperLinkColumn at Runtime in Asp.net

Can I ask what might be reason for dynamically creating a datagrid? if the grid needs to be shown conditionally, you can always use the "visible" property of the grid ..

dynamic controls are not so easy to work with .. also note that dynamic controls are NOT automatically created for every postback and so you will have to keep a track whether the datagrid was created in the previous postback and create it again in page "LOAD" or "INIT" event ..



Can anybody pls help, am I missing any page specific property or page level setting,I even created the same grid with nested grids but still having the exact same problem??Can any expert out thr help me with this as it is holding me up from moving further.


Hi Rejojohny
I created the grid at design time ,every thing works fine but later I had to change it to dynamic bec I have to show multiple grids based upon the currencies in the database. I cannot hardcode the no. of grids as tommorow the no. of currencies(USD,EUR) may increase for the client...I hope u get my point...
Unlock this solution and get a sample of our free trial.
(No credit card required)
Unlock this solution and get a sample of our free trial.
(No credit card required)
Forced accept.

EE Admin
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.