Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Need to Hook into the URLControl to reset the default chosen Link TypeNeed to Hook into the URLControl to reset the default chosen Link Type
Previous
 
Next
New Post
4/20/2007 9:48 AM
 

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]


Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
New Post
4/20/2007 11:29 AM
 

PARTIAL SUCCESS!

I was able to set the default to "Page" like I wanted, but I cannot fire the "ShowControls" sub that renders the accompanying controls respectively.  Does anyone have any ideas for a viable workaround here?  I need to simulate or call the selectedindex_changed event...

Here is the code that worked to change the default selected radio button...  (The key is to call this method in the Page_PreRender event.)

' set the default chosen URL type in the URL control
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
For Each ctl In Me.ctlURL.Controls
    ' A Control is found
    If ctl.HasControls Then
        ' This Control has controls
        For Each ctlInner In ctl.Controls
            ' Begin INNER LOOP
            If ctlInner.GetType.ToString = "System.Web.UI.HtmlControls.HtmlTableCell" Then
                ' The INNER INNER loop is next
                For Each ctlInnerInner In ctlInner.Controls
                    ' Begin INNER INNER LOOP
                    If ctlInnerInner.GetType.ToString = "System.Web.UI.WebControls.RadioButtonList" Then
                        ' THIS CONTROL IS THE RIGHT TYPE!!!
                        ' this is a radiobuttonlist
                        ctlRadio = CType(ctlInnerInner, System.Web.UI.WebControls.RadioButtonList)
                        ctlRadio.Items.FindByText(Localization.GetString("URLType.Text", _
                            Me.ctlURL.LocalResourceFile)).Selected = False
                        ctlRadio.Items.FindByText(Localization.GetString("TabType.Text", _
                            Me.ctlURL.LocalResourceFile)).Selected = True
                    End If
                Next
                ' End INNER INNER loop
            End If
        Next
        ' End INNER LOOP
    End If
Next


Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Need to Hook into the URLControl to reset the default chosen Link TypeNeed to Hook into the URLControl to reset the default chosen Link Type


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out