Which checkbox was checked?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim M

    #1

    Which checkbox was checked?

    I have added 10 checkboxes to my aspx web page. Is there anyway to figure
    out which checkbox caused the postback without having 10 different "handles
    routines".

    Thanks in advance.


  • Cor

    #2
    Re: Which checkbox was checked?

    Hi Jim,

    Buttons but the method is the same I think,
    (I also have it from checkboxes on a winform, from that I made this)

    I hope this helps?

    Cor
    \\\
    Private Sub Page_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArg s) Handles MyBase.Load
    Dim mybutton(31) As Button
    Dim i As Integer
    For i = 0 To New Date().DaysInMo nth _
    (New Date().Year, New Date().Month) - 1
    mybutton(i) = New Button
    mybutton(i).Bac kColor = Drawing.Color.W hite
    mybutton(i).Tex t = (i + 1).ToString
    mybutton(i).Wid th = New Unit(30)
    Me.Panel1.Contr ols.Add(mybutto n(i))
    AddHandler mybutton(i).Cli ck, AddressOf mybutton_Click
    If (i + 1) Mod 5 = 0 Then
    Me.Panel1.Contr ols.Add(New LiteralControl( "<BR>"))
    End If
    Next
    End Sub
    Private Sub mybutton_Click _
    (ByVal sender As Object, ByVal e As System.EventArg s)
    Dim mylabel As New Label
    Me.Panel1.Contr ols.Add(New LiteralControl( "<BR><BR>") )
    Me.Panel1.Contr ols.Add(mylabel )
    mylabel.Text = "The day is: " & DirectCast(send er, Button).Text
    End Sub
    ///
    Link
    http://msdn.microsoft.com/library/de...satruntime.asp


    Comment

    Working...