persisting changes to a control outside a user control from the user control?

Discussion in 'ASP .Net' started by Mad Scientist Jr, Mar 22, 2006.

  1. my login user control has this public property, passed from the calling
    page:

    Public TableContent As Table

    is this byref? if not how can it be made so?

    when the user logs in, the user control calls a content object to show
    or hide rows in TableContent

    However, it doesn't seem to be working - the rows are not getting
    shown/hidden when the user clicks the Login button on the user control.
    The rows get shown/hidden on the next postback, but I'm pretty sure
    this is the calling page itself which also calls the content object on
    page load. My guess is the TableContent isn't getting passed back from
    the user control, which could be the public property being not byref?

    much appreciated...

    btw The Content object show/hide method is something like

    Public Shared Sub ShowHideContent(ByRef TableContent As Table,
    ByVal GuestAccess as Boolean, ByVal FullAccess as Boolean)

    ....
    For iLoopInner = 0 To ContentTable.Rows.Count - 1
    sName = NextTable.Rows(iLoopInner).ID

    If Left(sName, 5) = "Guest" Then
    If GuestAccess Then
    ContentTable.Rows(iLoopInner).Visible = True
    Else
    If InStr(sName, "HideIfNoAccess=1") > 0 Then
    ContentTable.Rows(iLoopInner).Visible =
    False
    Else

    DisableHyperlinks(ContentTable.Rows(iLoopInner), "(Login required)")
    End If
    End If
    End If

    If Left(sName, 5) = "Full_" Then
    If FullAccess Then
    ContentTable.Rows(iLoopInner).Visible = True
    Else
    If InStr(sName, "HideIfNoAccess=1") > 0 Then
    ContentTable.Rows(iLoopInner).Visible =
    False
    Else

    DisableHyperlinks(ContentTable.Rows(iLoopInner), "(Full membership
    required)")
    End If
    End If
    End If
    Next ' For iLoopInner = 0 To ContentTable.Rows.Count - 1


    ....

    Private Shared Sub DisableHyperlinks(ByRef NextRow As TableRow,
    ByVal sNoAccessText As String)
    Dim tColNext As TableCell
    Dim NextControl As Control
    For Each tColNext In NextRow.Cells
    For Each NextControl In tColNext.Controls
    If NextControl.GetType.ToString =
    "System.Web.UI.WebControls.HyperLink" Then
    CType(NextControl, HyperLink).Text = sNoAccessText
    CType(NextControl, HyperLink).NavigateUrl = ""
    End If
    Next
    Next
    End Sub ' DisableHyperlinks
    Mad Scientist Jr, Mar 22, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2lvYmhhbg==?=

    Persisting user login credentials across pages

    =?Utf-8?B?U2lvYmhhbg==?=, Feb 20, 2005, in forum: ASP .Net
    Replies:
    19
    Views:
    830
    =?Utf-8?B?U2lvYmhhbg==?=
    Feb 28, 2005
  2. tshad
    Replies:
    3
    Views:
    551
    tshad
    May 19, 2006
  3. jebecker@_NO_SPAM_.pointroll.com

    Issues Persisting Design time changes to page source

    jebecker@_NO_SPAM_.pointroll.com, Jul 13, 2006, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    114
    jebecker@_NO_SPAM_.pointroll.com
    Jul 14, 2006
  4. Matthew Margolis

    keep changes in string outside of scope?

    Matthew Margolis, Sep 27, 2004, in forum: Ruby
    Replies:
    9
    Views:
    105
    Robert Klemme
    Sep 28, 2004
  5. Krzysztof Poc

    outside type, outside function

    Krzysztof Poc, Feb 3, 2012, in forum: C++
    Replies:
    1
    Views:
    282
    Victor Bazarov
    Feb 7, 2012
Loading...

Share This Page