A bit stuck adding code to Buttons
I'm writing a program which accessess function in a .dll which occasionally raises events. I'm Caputuring these events within my program and I want to display a prompt (much like a modal dialog box) so the user can ok/cancel it. I've donr the code which creates the Box , labels and buttons but what I can't seem to work out is how to attach code to the buttons I have created. Bascially all I want is when they click a button it sets a values to true or false. Because the button doesn't exist until runtime I cant add an event handler, is there a way to do this when I create the button?
This function is in a code file and creates the button:
Code:
Dim wcButton As New Button
wcButton.ID = Name
wcButton.Text = defaultvalue
wcButton.Style.Add("Position", "Relative")
wcButton.Style.Add("Left", Left)
wcButton.Style.Add("Top", Top)
wcButton.Style.Add("Height", Height)
wcButton.Style.Add("Width", Width)
wcButton.Enabled = Enabled
wcButton.Visible = Visible
wcButton.ToolTip = Tooltip
If (TabIndex <> 0) Then
wcButton.TabIndex = TabIndex
End If
The event handler calls a function to create a Prompt which creates a GenericHTMLControl and add the buttons and Labels as WebControls. This generic Control is then added to the page.
I'm not entirly sure if this is the correct approach for how to create Modal style dialogs so if anyone else has a good way to implement them in ASP.NET please tell me.
Andrew Aitken