开发者

Repeater does not fire ItemCommand event

I searched the web on this topic and got plenty of suggestions from every one (including other stackoverflow threads).

Finally, I thought implement as shown exactly here.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.onitemcommand(VS.71).asp开发者_开发知识库x

Still frustrated.

My repeater is available in a user control and I added the user control as a web part to an existing webpartzone. I could see all rows in the repeater (along with buttons). Once I click the (any) button, it loses all the rows and itemcommand never fires.

I am using ASP.NET 4.0

Can anyone help me on this.


Databound list controls (just like any other dynamically-created controls) need to be recreated on postback. Do you have your Databind call within an if (!IsPostback) {} ?

Source code might help determine your specific issue.


All the time, the Repeater has to be bound. Otherwise, Repeater_ItemCommand EVENT of the Repeater won't be fired.

That means:

     if (!IsPostBack)
            {
               BindRepeater();
            }
            else
            {
                BindRepeater();

            }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜