I want to try and hook into the URLControl to set the default Link Type to be something else, but I didn't notice any exposed properties or methods to allow me to do this. Instead, I began writing a loop to find the correct control (optType). I did this successfully, but during the "LoadSettings" method of the Settings page cycle, the items are not yet bound to the optType RadioButtonList.
Does anyone have any ideas about how I can do this?
Here is my example code (with traces still in place):
Dim ctlRadio As System.Web.UI.WebControls.RadioButtonList
Dim ctl As System.Web.UI.Control
Dim ctlInner As System.Web.UI.Control
Dim ctlInnerInner As System.Web.UI.Control
' look for the URL type control
Try
For Each ctl In Me.ctlURL.Controls
Trace.Warn("A Control is found.")
Trace.Warn("ctl.GetType.ToString = " & ctl.GetType.ToString)
If ctl.HasControls Then
Trace.Warn("This Control has controls.")
For Each ctlInner In ctl.Controls
Trace.Warn("Begin INNER LOOP")
Trace.Warn("ctlInner.GetType.ToString = " & ctlInner.GetType.ToString)
Trace.Warn("ctlInner.HasControls = " & ctlInner.HasControls.ToString)
If ctlInner.GetType.ToString = "System.Web.UI.HtmlControls.HtmlTableCell" Then
Trace.Warn("The INNER INNER loop is next")
Trace.Warn("ctlInner.HasControls = " & ctlInner.HasControls.ToString)
For Each ctlInnerInner In ctlInner.Controls
Trace.Warn("Begin INNER INNER LOOP")
Trace.Warn("ctlInnerInner.GetType.ToString = " & ctlInnerInner.GetType.ToString)
If ctlInnerInner.GetType.ToString = "System.Web.UI.WebControls.RadioButtonList" Then
Trace.Warn("'====================================================='")
Trace.Warn("THIS CONTROL IS THE RIGHT TYPE!!!")
' this is a radiobuttonlist
ctlRadio = CType(ctlInnerInner, System.Web.UI.WebControls.RadioButtonList)
Trace.Warn("... ctlRadio.Items.Count = " & ctlRadio.Items.Count)
Trace.Warn("... ctlRadio.ID = " & ctlRadio.ID)
' if you uncomment this, it will throw an exception because the required
' items have not yet been bound to the radiobuttonlist control
'ctlRadio.Items.FindByText(Localization.GetString("TabType.Text", _
' Me.ctlURL.LocalResourceFile)).Selected = True
Trace.Warn("'====================================================='")
End If
Next
Trace.Warn("End INNER INNER loop")
End If
Next
Trace.Warn("End INNER LOOP")
End If
Next
[EDIT]
It would be MUCH nicer if the core simply exposed a new property or method to allow us to change the default. I could do it, but I refrain from modifying the core as much as possible. :)
[/EDIT]