List Info

Thread: ImageButton Postback help




ImageButton Postback help
user name
2006-07-05 01:13:32
I cant figure out why this ImageButton doesn't post back
the way a Button
does. Can anyone explain to me why the RaisePostBackEvent()
method doesn't
get called here..

 

public class MyControl : CompositeControl,
IPostBackEventHandler

    {

        ImageButton img;

        protected override void CreateChildControls()

        {

            this.CreateControls();

        }

        private void CreateControls()

        {

            img = new ImageButton();

            img.ID = this.UniqueID;

        }

 

        protected override void Render(HtmlTextWriter
writer)

        {

           img.RenderControl(writer);

        }

 

        #region IPostBackEventHandler Members

 

        public void RaisePostBackEvent(string eventArgument)

        {

            throw new Exception("The method or
operation is not
implemented.");

        }

 

        #endregion

    }

 

If I change the ImageButton to a Button, the
RaisePostBackEvent is called,
but not with a ImageButton. Also, I'd like to write up a
Command Event
instead of the whole RaisePostbackEvent but that wouldn't
fire either.

 

What silliness is happening here?

 

Thanks

t




Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )