Itemcommand and Datalist problem

K

Kenneth

Hi there,
The OnItemCommand in my datalist is acting very weirdly,
the first time the page is loaded(or anything on the
datalist is clicked for the first time) its firing only
once, but after that its firing twice. I have no idea why,
Any help would be really appreciated. Thanks in advance

Note:
I am using AutoEventWireup="true",but also checking for
Page.Ispostback in my Page_Load.
I am not setting up EnableViewState=True in my datalist.

Thanks
Kenneth
 
N

Natty Gur

Hi,

The MSDN documentation recommends not setting
AutoEventWireup to true: "If you do set AutoEventWireup to true, Visual
Studio will generate code to bind the events and the page framework will
automatically call events based on their names. This can result in the
same event code being called twice when the page runs. As a consequence,
you should always leave AutoEventWireup set to false when working in
Visual Studio."
(
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/h
tml/vbconWebFormsEventModel.asp )

by the way I try it with simple form (vb,c#) and didn’t get the behavior
you mention.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
K

Kenneth

Thanks for your reply, i actually changed the
autoeventwireup to false.,but its still doing it?

-K
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top