code_junkie

Why isn't my EventHandler firing (Asp.Net C#)

Nov 13th, 2011
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. protected void MakeUploadButton(attachment a, PlaceHolder ph)
  2. {
  3. LinkButton lb = new LinkButton()
  4. {
  5. Text = "Upload New " + a.attachment_type.type_name,
  6. CssClass = "button right",
  7. ID = "lb" + a.attachment_type.file_tag,
  8. CommandArgument = a.attachment_type_id.ToString(),
  9. CommandName = a.attachment_type.type_name,
  10. CausesValidation = false
  11. };
  12. lb.Click += new EventHandler(showModalPopup);
  13. lb.DataBind();
  14. ph.Controls.Add(lb);
  15. }
  16.  
  17. Protected Sub Page_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  18. If Page.IsPostBack Then
  19. Dim lb as ListButton = TryCast(Page.FindControl("IDOfControl"), LinkButton)
  20. lb.Click += new EventHandler(showModalPopup);
  21. End If
  22. End Sub
Add Comment
Please, Sign In to add comment