[thelist] asp.net (vb) adding linkbuttons dynamicaly

Casey Crookston casey at thecrookstons.com
Tue Dec 28 17:05:14 CST 2004


I'm adding a series of linkbuttons based on database rows.  Two questions.
First, is the linkbutton.CommandArgument the appropriate property to use to
assign a value to the link button?  I need to match the button with the
database row key id.  Second, how do you assign an on_click event? The way I
have it does not work:


While myMemberListDtr.Read()
  Dim LnkBtn As New LinkButton()
  plhPlaceHolder.Controls.Add( New LiteralControl( "<td>))
  LnkBtn.Text = myMemberListDtr("lname") & ", " & myMemberListDtr("fname")
  LnkBtn.CommandArgument = myMemberListDtr("mem_id")
  LnkBtn.OnClick = linkbutton_click
  plhPlaceHolder.Controls.Add(LnkBtn)
  plhPlaceHolder.Controls.Add( New LiteralControl( "</a></td>" ))
End While

Thanks!!!

Casey




More information about the thelist mailing list