[thelist] ASP.NET: Passing the value of a link button

Casey Crookston caseyc at IntelliSoftmn.com
Tue Aug 8 11:35:16 CDT 2006


PETER:

I think I already answered that... just use Sender.Property to get
whatever properties you need from the sender (control that triggered the
event).

CASEY:

Yup, I went back and looked at the post where you mentioned this.  I'm
just unclear on the exact syntax:

Public Sub AlphaCommand(ByVal sender As Object, ByVal e As
System.EventArgs)
	Dim strCatLetter As String = sender.?????????
End Sub

The only popup option that Visual Studio gives me at sender. is GetType

PETER:

So what was the solution for the untouched subroutine?

CASEY:

Because the linkbutton controls are dynamic they need to be created in
each page cycle.  I added  populateAlpha() to the pageload and it
worked.

Private Sub populateAlpha()
 Dim i As Integer
 For i = 65 To 90
  Dim lbAlpha As LinkButton = New LinkButton
  lbAlpha.Text = "&#" & i & "; "
  lbAlpha.CssClass = "alpha_link"
  lbAlpha.ID = "lbAlpha" & i
  AddHandler lbAlpha.Click, New EventHandler(AddressOf AlphaCommand)
  plhAlpha.Controls.Add(lbAlpha)
 Next
End Sub

Thanks for all the help!







More information about the thelist mailing list