Itemcommand and Datalist problem

  • Thread starter Thread starter Kenneth
  • Start date Start date
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
 
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
 
Thanks for your reply, i actually changed the
autoeventwireup to false.,but its still doing it?

-K
 
Back
Top