No click event from a button in a TableCell 
Author Message
 No click event from a button in a TableCell
I'm doing the following
Protected WithEvents m_lnkNext As LinkButton

Protected WithEvents tbl As System.Web.UI.WebControls.Table

...

m_lnkNext = New LinkButton
m_lnkNext.Text = "Next..."
m_lnkNext.Width = New Unit(54, UnitType.Pixel)
m_lnkNext.Height = New Unit(25, UnitType.Pixel)
m_lnkNext.CausesValidation = True
AddHandler m_lnkNext.Click, AddressOf btnNext_Click
tbl.Rows(1).Cells(1).Controls.Add(m_lnkNext)

I seem to get other events fired but not click.
It behaves the same with a regular button and the AddHandler and WithEvents
are interchangeable with no effect

Any help is appreciated.

Rich



Thu, 22 Sep 2005 10:18:44 GMT  
 No click event from a button in a TableCell
I found my problem.

I was initializing the event handler in the form load inside a
if Not IsPostBack

end if

which meant that when the user clicked th button and the postbak occured the
reloaded form didn't have an event handler..

rich


Quote:
> I'm doing the following
> Protected WithEvents m_lnkNext As LinkButton

> Protected WithEvents tbl As System.Web.UI.WebControls.Table

> ...

> m_lnkNext = New LinkButton
> m_lnkNext.Text = "Next..."
> m_lnkNext.Width = New Unit(54, UnitType.Pixel)
> m_lnkNext.Height = New Unit(25, UnitType.Pixel)
> m_lnkNext.CausesValidation = True
> AddHandler m_lnkNext.Click, AddressOf btnNext_Click
> tbl.Rows(1).Cells(1).Controls.Add(m_lnkNext)

> I seem to get other events fired but not click.
> It behaves the same with a regular button and the AddHandler and
WithEvents
> are interchangeable with no effect

> Any help is appreciated.

> Rich



Thu, 22 Sep 2005 10:50:38 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Right Button Click emulating Left Button Click

2. Accessing the click event for a button on a custom form

3. Word com add-in and button click events

4. Calling MS-Word from button event click on outlook 98/2000

5. simulating cmd button click event

6. Button Click Event Not Firing !

7. How to make the button in Usercontrol call Usercontrol's Click event

8. System.EventArgs parameter in button click events.

9. Raising button click events in the same class

10. Click Event of Button controls in Array

11. How do I activate the click event of a button in code

12. Click-Event for runtime-built Toolbar Button Dropdown Menu

 

 
Powered by phpBB® Forum Software