Setting an initial value for a Checkbox
I've found a way to initialize textboxes for my detailsview insert, but now I need to do the same for checkboxes (some need to start as true). The following is my code for textboxes:
Protected Sub DetailsView1_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.PreRender
If DetailsView1.CurrentMode = DetailsViewMode.Insert Then
Dim ThisControl As TextBox
ThisControl = DetailsView1.FindControl("InsertEventName")
ThisControl.Text = "new event"
ThisControl = DetailsView1.FindControl("InsertDays")
ThisControl.Text = "1"
End if
End Sub
Frankly, I don't completely understand it all because I'm a newbie and still struggling with developing my .net skills. I've tried the obvious to make it work for checkboxes too, but when I insert this:
Dim ThisCheck As Checkbox
ThisCheck = DetailsView1.FindControl("RegisterOnline")
ThisCheck.Checked = True
I get an error message that says BC30456: 'Checked' is not a member of 'System.Web.UI.Control'.
What am I missing?
|