Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 4th, 2005, 09:42 PM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing Parameters to UC

Hi,

Will someone share how you would pass parameters from the main page
to a custom control, that's being loaded from a placeholder, through the public
properties of the custom control?

In other words:

Test01.aspx has a <ASP:PLACEHOLDER RUNAT=server ID="Phl01"></ASP:PLACEHOLDER>
and on button click will load pageuc.ascx:

    Dim urc as Control = LoadControl("pageuc.ascx")
    Phl01.Controls.Add(urc)

somewhere here I would like to pass some parameters to urc.

pageuc.ascx.vb has:

Private _myParameter as String
Public Property myParameter() as String
  Get
    Return _myParameter
  End Get
  Set
    _myParameter = value
  End Set
End Property

Your replies are appreciated :D !
 
Old January 5th, 2005, 01:44 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

Through Properties you can send parameters to Custom Control.
You have object of custom control in the main page.Set the property of the custom control after creating the object like urc.myParameter="ParameterULikeToPass"

Below should be in CustomControl class..
Public Property myParameter as String
  Get
    Return _myParameter
  End Get
  Set
    _myParameter = value
  End Set
End Property


 
Old January 5th, 2005, 03:25 PM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply Santhi.

Actually, the first problem is to load it first.
Then passing the parameters through my public properties.

I figured it out with this:

 Dim urc As pageuc = CType(LoadCOntrol("pageuc.ascx"), pageuc)
 urc.myParameter="test"
 PlhResults.Controls.Add(urc)

works like a charm ! Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
passing parameters fizzerchris Access VBA 5 August 31st, 2007 12:16 PM
Passing parameters tal Ajax 5 May 26th, 2007 08:07 AM
Passing parameters ceema Crystal Reports 0 February 15th, 2006 04:03 AM
Passing Parameters spraveens Javascript 5 October 8th, 2003 07:06 AM
passing parameters spraveens Javascript How-To 1 October 8th, 2003 03:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.