Ask a Question related to ASP.NET General, Design and Development.
-
Akira #1
Passing parameters to user controls
Hello.
I'm having problem with passing parameters from .aspx file to user
control.
Could anyone tell me how to pass parameters from .aspx file to user
control(.ascx) and how to recieve parameters at .ascx?
Thank you for your help!
Akira Guest
-
using javascript in User controls to access server controls of the user control
Hello all, I have an asp.net textbox (named txtHidden) and an HtmlButton(named btnAction). I wanted to write a javascript function which will get... -
Passing Parameters to User Controls that are Dynamically Loaded in Placeholders
Hi Guys, I have been having a big problem with trying to pass parameters into a user control when the user control is dynamically loaded into a... -
Loading controls dynamically + passing parameters
Hi, I can use following syntax to add user controls directly to my pages : <XYZ:myControl parameter1="value1" parameter2="value2"... -
Passing parameters to Windows Controls
Hi All, I have developed a windows forms user control, which I am going to host in Internet Explorer.. I am familiar with the security settings... -
Help Passing Parameters
Before going to the third script I'd suggest storing the variables in session variables. Here's how I generally do login scripts. Perhaps have... -
Cowboy \(Gregory A. Beamer\) #2
Re: Passing parameters to user controls
Open the CodeBehind file and add the user control to the controls
collection. Not sure why, but, by default, a user control is placed on the
page but never given a corresponding line in the CodeBehind file.
Dim NameOfControlOnPage As MyControl
protected MyControl NameOfControlOnPage;
You can see the lines of other controls in your CodeBehind, so the above
templates are suspect. Once you do this, you will be able to use:
NameOfControlOnPage.PropertyOne = "";
to set values.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge
************************************************** **************************
****
Think Outside the Box!
************************************************** **************************
****
"Akira" <akira@regonline.com> wrote in message
news:3239e228.0307020936.20748177@posting.google.c om...> Hello.
> I'm having problem with passing parameters from .aspx file to user
> control.
> Could anyone tell me how to pass parameters from .aspx file to user
> control(.ascx) and how to recieve parameters at .ascx?
> Thank you for your help!
Cowboy \(Gregory A. Beamer\) Guest
-
Karl Seguin #3
Re: Passing parameters to user controls
use properties...or public fields :)
user control:
private _ValueID as integer
Public Property ValueID as integer
Get
return _ValueID
ENd Get
Set (byval value as integer)
_ValueID = value
end set
end property
From within the user control you can simply refer to "ValueID" from
thereonin to get the value that was assigned to it by the parent.
Parent:
Two methods
<control:name runat="server" id="cntrl" ValueID=3 />
in codebehind
cntrl.ValueID = 3
Karl
"Akira" <akira@regonline.com> wrote in message
news:3239e228.0307020936.20748177@posting.google.c om...> Hello.
> I'm having problem with passing parameters from .aspx file to user
> control.
> Could anyone tell me how to pass parameters from .aspx file to user
> control(.ascx) and how to recieve parameters at .ascx?
> Thank you for your help!
Karl Seguin Guest



Reply With Quote

