Event Handler Not Called.

G

Guest

Hi,
I have a WebControl.Table on my WebForm. In the Table I have LinkButtons.
I inserted and created these link buttons dynamically. Please Look at the
Code below.

LinkButton lb = new LinkButton();
lb.Text = "Details";
lb.Click += new System.EventHandler(this.LinkButton_Click);
Table1.Rows.Cells[2].Controls.A(lb);

Now when I click on the Link Button the Page does a post back but the
LinkButton_Click function is not called.

In fact, I tried adding a regular button to the table statically and then
tried clicking on the button but the appropriate handler is not called. The
Page does do a post back but the handler is not called. Can some one tell me
why? and How do I fix it?

Shreyash.
 
S

Shiva

Are you recreating the LinkButton control on postback also? If not, the
Click event handler will not be called on postback.

message Hi,
I have a WebControl.Table on my WebForm. In the Table I have LinkButtons.
I inserted and created these link buttons dynamically. Please Look at the
Code below.

LinkButton lb = new LinkButton();
lb.Text = "Details";
lb.Click += new System.EventHandler(this.LinkButton_Click);
Table1.Rows.Cells[2].Controls.A(lb);

Now when I click on the Link Button the Page does a post back but the
LinkButton_Click function is not called.

In fact, I tried adding a regular button to the table statically and then
tried clicking on the button but the appropriate handler is not called. The
Page does do a post back but the handler is not called. Can some one tell me
why? and How do I fix it?

Shreyash.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top