By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,948 Members | 1,857 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,948 IT Pros & Developers. It's quick & easy.

ItemCreated Event of datagrid is firing twice.

P: n/a
Hi all,

I am having one datagrid whose datasource i set as array.

On itemcreated event i am having one counter which i have used to find
out how many times item created event is fired.

What i observerd is itemcreated event is fired twice than total items
present in array.

why is it so?

can anyone tell me reason behind this.

thanks in advance.

Apr 10 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Apr 10, 10:27 am, "archana" <trialproduct2...@yahoo.comwrote:
Hi all,

I am having one datagrid whose datasource i set as array.

On itemcreated event i am having one counter which i have used to find
out how many times item created event is fired.

What i observerd is itemcreated event is fired twice than total items
present in array.

why is it so?

can anyone tell me reason behind this.

thanks in advance.
Are you calling DataBind? Are you using an ObjectDataSource?

Apr 10 '07 #2

P: n/a
This could happen if you have subscribed to the event twice, e.g. if you have
placed in the HTML markup OnItemCreated and then issued an AddHandler in the
codebehind to wire up the same event. Search your project for the
occurrences of the method name; if you find it wired twice then that is the
cause of it.

Otherwise, it can be due to the databinding happening twice, e.g. if you
databind upon page_load but not use "If Not Page.IsPostBack Then" condition.
Set a break point in the last line of the eventhandler to see from where it
is being called.

--
HTH,
Phillip Williams
http://mcts-study-practices.com/
http://www.webswapp.com
"archana" wrote:
Hi all,

I am having one datagrid whose datasource i set as array.

On itemcreated event i am having one counter which i have used to find
out how many times item created event is fired.

What i observerd is itemcreated event is fired twice than total items
present in array.

why is it so?

can anyone tell me reason behind this.

thanks in advance.

Apr 10 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.