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.0FindControl, finds the control, but values are emptyFindControl, finds the control, but values are empty
Previous
 
Next
New Post
12/19/2007 10:03 AM
 

I have a custom control, of DropDownList type. The page that displays it, has some cases, where the control is visible or not, however, it is always created in Page.Init. When I do Postback, I can find the control in both Init and Load events, however the selectedValue is null.

When using this control in a simpler page, outside DotNetNuke, it works fine.

 
New Post
12/20/2007 12:13 AM
 

Is the problem that the DropDownList is always rendered, even when you don't want it? If so, where is the logic that determines if it is visible and what does it look like?

Maybe it would help to clarify if you provided some of your code.

 
New Post
12/20/2007 5:30 AM
 

This is the code inside the module:

Private agentsDDList As STCustomControls.AgentsListBox

        Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            Dim m_UserName As String
            m_UserName = "" + CType(Session("Username"), String)

            Dim u As New UserController

            If m_UserName.Length > 0 Then
                If Not u.GetCurrentUserInfo.IsSuperUser Then
                    Me.agentsHolder.Controls.Add(getAgentsSelectBox(agentsHolder))
                End If
            End If
        End Sub

        Protected Sub actionChange(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
            bindData(e.CommandArgument.ToString)
        End Sub

        Private Sub bindData(ByVal action As String)
            Try
                Select Case action
                    Case "criteria"
                        criteria = getCriteriaByForm(agentsHolder)
                        colBookingLists = objBookingLists.GetBookingListsByCriteria(ModuleId, CType(Session("Username"), String), CType(Session("Password"), String), criteria)
                        CriteriaTable.Visible = False
                        VoucherDatesTable.Visible = False
                        lstContent.Visible = True
                        'criteria changed, removing cache
                        Cache.Remove("dgCache")
                        lstContent.DataSource = sortDataTable(colBookingLists, ViewState("SortOrder").ToString)
                        lstContent.DataBind()
                    Case "editCriteria"
                        CriteriaTable.Visible = True
                        VoucherDatesTable.Visible = False
                        lstContent.Visible = False
                End Select
            Catch exc As Exception           'Module failed to load
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

        Private Function getCriteriaByForm(ByRef ctrlHolder As Control) As Hashtable
            Dim arrCrit As New Hashtable
            Dim agSel As Specialtours.DNN.STCustomControls.AgentsListBox = STOnlineCommon.FindControlRecursive(ctrlHolder, "AgentsSelBox:" + ctrlHolder.ID)

            arrCrit.Add(STOnlineCommon.HASH_SRV_STATUS, txtSrvStatus.Value)
            arrCrit.Add(STOnlineCommon.HASH_DOPTION_FROM, optDateIn.Value)
            arrCrit.Add(STOnlineCommon.HASH_DOPTION_TO, optDateOut.Value)
            arrCrit.Add(STOnlineCommon.HASH_DCREATE_FROM, DateIn.Value)
            arrCrit.Add(STOnlineCommon.HASH_DCREATE_TO, DateOut.Value)
            arrCrit.Add(STOnlineCommon.HASH_DIN_FROM, creDateIn.Value)
            arrCrit.Add(STOnlineCommon.HASH_DIN_TO, creDateOut.Value)
            arrCrit.Add(STOnlineCommon.HASH_LEADER, txtLeader.Value)
            arrCrit.Add(STOnlineCommon.HASH_MEMO, txtMemoKey.Value)

            arrCrit.Add(STOnlineCommon.HASH_REM_CNT_CRIT, agSel.SelectedValue)
            arrCrit.Add(STOnlineCommon.HASH_STOL_COAGENT_ID, 0)

            arrCrit = formatCriteria(arrCrit)
            Return arrCrit

        End Function

        Private Function getAgentsSelectBox(ByRef holder As Control) As STCustomControls.AgentsListBox
            Dim bldp As New BookingList.SqlDataProvider
            Dim agents As New Specialtours.DNN.STCustomControls.AgentsListBox
            agents.UserID = CType(Session("STOLUserID"), String)
            agents.UserName = CType(Session("Username"), String)
            agents.Password = CType(Session("Password"), String)
            agents.connectionString = bldp.ConnectionString
            agents.DefaultText = " All"
            agents.DefaultValue = "0"
            agents.CssClass = "fldData"
            agents.Width = 252
            agents.ID = "AgentsSelBox:" + holder.ID.ToString
            agents.ctrlHolder = holder
            Return agents
        End Function

I don't know if this code helps. The problem is that when I am asking agSel.SelectedValue I am getting null

 
New Post
12/20/2007 6:36 PM
 

Hmm, this looks like a tough one to debug just by looking at it. Is the agSel object null, or just the SelectedValue property? If it's just the SelectedValue property, my guess is that your custom control is not getting that property set properly when the SelectedIndexChanged event fires.

 
New Post
12/21/2007 5:29 AM
 

Tough debug? I 've spend days on this...

No, the object is full, just the selected value is empty.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0FindControl, finds the control, but values are emptyFindControl, finds the control, but values are empty


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