473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

UserControl with parameters

I have created a UserControl which takes two input parameters to run.

I now would like to use this UserControl in aspx page in which the user can
supply two parameters.

How can I pass these parameters from aspx to the UserControl ?

Thank you very much for your help.

Kiyomi
Nov 19 '05 #1
5 1386
if you dragged and dropped the control onto the form you might find that
there is no definition for the control on the page. If you put that in you
will have access to methods and properties on the control.

such as....

protected myproject.userControls UserAccess1;
Nov 19 '05 #2
Hi Kiyomi,
To supply input values to the user controls, you should define public
properties in the user control.

For ex. you have give the property in the usercontrol is like "ProductName".
In the aspx page pass value to "ProductName" property as below.

<tagPrefix:tagname .... ProductName="Press" >

Hope this helps you.
Thanks,
Ragu.


"Kiyomi" wrote:
I have created a UserControl which takes two input parameters to run.

I now would like to use this UserControl in aspx page in which the user can
supply two parameters.

How can I pass these parameters from aspx to the UserControl ?

Thank you very much for your help.

Kiyomi

Nov 19 '05 #3
Take a look at this article:
http://openmymind.net/index.aspx?documentId=9

should shed some light.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Kiyomi" <k.*******@unesco.org> wrote in message
news:OZ**************@TK2MSFTNGP10.phx.gbl...
I have created a UserControl which takes two input parameters to run.

I now would like to use this UserControl in aspx page in which the user
can
supply two parameters.

How can I pass these parameters from aspx to the UserControl ?

Thank you very much for your help.

Kiyomi

Nov 19 '05 #4
Thank you, Josh, for your prompt reply.

Since I am using vb so I have placed the following code in my aspx page :

Protected WithEvents UserAccess1 As myproject.userControls

Although userControls.ascx (and Cass userControls) exsits, .NET does not
want to recognize it and tells me "Type myproject.userControls is not
defined."

Do I have to import something ?
"Josh" <s@a.com> wrote in message
news:uK**************@TK2MSFTNGP15.phx.gbl...
if you dragged and dropped the control onto the form you might find that
there is no definition for the control on the page. If you put that in you will have access to methods and properties on the control.

such as....

protected myproject.userControls UserAccess1;

Nov 19 '05 #5
> Protected WithEvents UserAccess1 As myproject.userControls

Although userControls.ascx (and Cass userControls) exsits, .NET does not
want to recognize it and tells me "Type myproject.userControls is not
defined."


check that your "myproject.userControls" is the namespace used in the code
beind file of the usercontrol, they should match
Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sascha | last post by:
Hi there, I searched carefully through the web before finally deciding to post this message, because I could not find a solution for my problem. Hopefully someone will have a hint or explanation...
0
by: mopa | last post by:
Hi On my aspx-page I have an usercontrol in an Insertitemtemplate on a formview. In the oninserting event for the formview I would liike to add some parameters whit values from the usercontrol....
1
by: DonR | last post by:
History: In VB6 I could create an OCX that had the ability to accept paramenters from a web page <object> tag, do some work, then fire an event back to VBScript or JavaScript on the web page where...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
6
by: p.mc | last post by:
Hi all, I'm having major problems with a userControl which contains a datagrid. My problem concerns data binding. The Page_Load() procedure calls the DataBind procedure to bind the datagrid...
1
by: Giovanni | last post by:
Dear Friends/Gurus, I have exhausted myself and have yet no solution to the following: I have an ASP.NET 2.0 Survey type application. On a page, I have placed a GridView which is bound to an...
7
by: Nathan Sokalski | last post by:
I have a UserControl (*.ascx) that has the following design: <div id="divFileDir" runat="server"> <asp:Image ID="imgIcon" runat="server" CssClass="icon" Height="16px" Width="16px"/>...
1
by: timdelong1 | last post by:
I was writing a usercontrol in ASP.NET that contained an objectdatasource, a gridview, and some other form controls (textboxes and dropdown lists). For the insertcommand parameters I associated...
0
by: Jens | last post by:
Hello, I've created a usercontrol that's cached: <%@ OutputCache Duration="43200" VaryByParam="none" %> UserControl.SubID = 2 UserControl.Subrubriek = "Test" When I load the page for the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.