I am struggling with this now as well. But Kevin is way off on the cause I
think. This has to do with the AutoEventWire up configuration of the page
and the AutoPostBack attribute of the control (I think). I am still looking
into this. Will let you know what I find out.

Gordon Humphrey
enterLogic Corporation


"Kevin Spencer" <kevin@SPAMMERSSUCKtakempis.com> wrote in message
news:%239GDnYSJDHA.3280@tk2msftngp13.phx.gbl...
> There's something wrong with the structure of your custom Control,
although
> I can only guess at what it is. The first clue I get is that you mention
> implementing BOTH the IPostBackDataHandler and IPostBackEventHandler
> interfaces. Although I've never tried implementing both (you should only
> implement one), I suspect that this might have something to do with it.
>
> HTH,
>
> Kevin Spencer
> Microsoft FrontPage MVP
> Internet Developer
> [url]http://www.takempis.com[/url]
> A watched clock never boils.
>
> "Marek Starosielec" <mstarosielec@maritweb.com> wrote in message
> news:bb294u$spe$1@news2.ipartners.pl...
> OK, here it goes:
>
> There is a ASP.NET page, with custom control on it. Control displays data
> from database, allows deleting, editing and adding new records (something
> like grid). So I start the page, click 'Add new data' button (part of
custom
> control), fill all necessary data and click 'Submit' button. Data is
posted
> by IPostBackDataHandler interface and events are handled by
> IPostBackEventHandler interface.
>
> 1) I click 'Add new data' button: Page_Load occurs, then custom control
> Render event.
> 2) I fill data and click 'Submit' button. LoadPostData and
> RaisePostBackEvent in custom control occurs, then Page_Load, then Render.
>
> It should stop at this point but sometimes LoadPostData and
> RaisePostBackEvent fire one more time. This causes adding 2 rows to
> database. What's funny, during record adding, I change variable in
> viewstate, indicating that data was added (so even if event occurs twice,
> data should be added only once). But if event occurs second time,
viewstate
> looses all chages (it is identical, like in first event occur).
>
> Any ideas?
>
>