开发者

Repeater does not fire ItemCommand event

开发者 https://www.devze.com 2023-01-19 07:42 出处:网络
I searched the web on this topic and got plenty of suggestions from every one (including other stackoverflow threads).

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

精彩评论

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