[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Datagrid events dont fire

Posted on 2007-10-09
8
Medium Priority
?
875 Views
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??
0
Comment
Question by:kpankaj9
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 20041671
Check the following article:

Creating DataGrid BoundColumn ButtonColumn HyperLinkColumn at Runtime in Asp.net
http://www.codeproject.com/useritems/datagridcloumns.asp

--Nauman.
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 20041783
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 ..

Rejo
0
 

Author Comment

by:kpankaj9
ID: 20041813
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.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:kpankaj9
ID: 20041855
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...
0
 
LVL 25

Accepted Solution

by:
nauman_ahmed earned 1000 total points
ID: 20041888
kpankaj9:

Creating the datagrid at runtime require some additional steps. The article that I have posted has some info. Please also take a loo at the following as it describes what you need to do in order to enable events for controls that are added at runtime:

Create Controls At Runtime
http://www.developerfusion.co.uk/show/4393/

--Nauman.
0
 
LVL 26

Assisted Solution

by:Rejojohny
Rejojohny earned 1000 total points
ID: 20041927
I think I understand your design issue .. can I suggest couple of other options
group all the columns by "currency" and use heirarchical grid .. grid within a grid
OR
user a repeater control and add a grid within it which repeats for every currency ..

your problem might be that the dynamic grid is not been created in page load and so the events are not getting fired ..

Rejo
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21022619
Forced accept.

Computer101
EE Admin
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question