Dynamic RadPageView passing a variable

5 posts, 0 answers
  1. Moon
    Moon avatar
    249 posts
    Member since:
    Oct 2012

    Posted 03 Nov 2008 Link to this post

    You have provided an example of how to create a dynamic RadPageView, loading a dynamic user control.
    http://demos.telerik.com/aspnet/prometheus/TabStrip/Examples/ApplicationScenarios/DynamicPageView/DefaultCS.aspx

    How does one then pass a variable value into this dynamic user control?

    Your example doesn't show that.

    thanks.

    Moon.

  2. Blaize
    Blaize avatar
    88 posts
    Member since:
    Oct 2006

    Posted 03 Nov 2008 Link to this post

    Hey Moon,

    what about

    ((MyUserControlType)multiPage.Controls[0]).MySpecificStringProperty = "Something"; ?

    or

    ((Label)multiPage.Controls[0].FindControl("MyLabel1")).Text = "Something"; ?

    Cheers,
    Blaize
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Moon
    Moon avatar
    249 posts
    Member since:
    Oct 2012

    Posted 03 Nov 2008 Link to this post

    Sorry, that confuses me.

    I use this in the PageViewCreated function:

            Dim userControlName As String = String.Empty
            userControlName = "~/Modules/Login/Controls/RegisterControl.ascx"
            Dim uc As Control = Page.LoadControl(userControlName)
            uc.ID = "pvRegister" & e.PageView.ID
            e.PageView.Controls.Add(uc)

    At this point, my control ID will be "pvRegisterForum" perhaps.

    My control name is: RegisterControl.ascx

    I want to call this function, SetuserType, within my control:

    Select Case e.PageView.ID
                Case Enums.UserType.Forums.ToString
                    myControl.SetUserType(Enums.UserType.Forums)

    How do I get the "myControl" value?
    How do I find this control and use it to call the SetUserType function?

    thanks.
  5. Moon
    Moon avatar
    249 posts
    Member since:
    Oct 2012

    Posted 03 Nov 2008 Link to this post

    BTW, I'm not certain the type to cast it to...

    I've tried this:

            Dim myControl = DirectCast(RadMultiPage1.Controls(0).FindControl(uc.ID), RadPageView)
            myControl.SetUserType(Enums.UserType.Forums)

    But it says SetUserType is not a member of RadPageView.

    I'm really lost on this. Sorry.
  6. Blaize
    Blaize avatar
    88 posts
    Member since:
    Oct 2006

    Posted 03 Nov 2008 Link to this post

    Hey Moon,

    You should use the following (assuming you use a web application project, but not a website):

    Dim myControl = DirectCast(RadMultiPage1.Controls(0).FindControl(uc.ID), [MyUserControlTypeName])
            myControl.SetUserType(Enums.UserType.Forums)


    I assume the user control has the SetUserType method already.

    If having a web site, the things get a bit trickier:
    You should create a base class (e.g. MyUserControlBase), deriving from UserControl to the App_Code folder. The base class should contain the SetUserType method in it. Then you should just modify your user control to inherit the MyUserControlBase class.

    Cheers,
    Blaize
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017