I want to create a bunch of like user controls and display them in a
DataList.
Does anyone have a GOOD example of how to do this?
I thought I had it...I added the user control to my <ItemTemplate >, created
an array of user controls in my code behind and set the DataSource and
called DataBind. But, all the user controls are unitialized when the page
is rendered.
Amil 2 2252
Amil Hanish wrote:
I want to create a bunch of like user controls and display them in a
DataList.
Does anyone have a GOOD example of how to do this?
I thought I had it...I added the user control to my <ItemTemplate >,
created an array of user controls in my code behind and set the
DataSource and called DataBind. But, all the user controls are
unitialized when the page is rendered.
Amil
Just put the user control in the template like you would do with any other
control (e.g. a textbox).
Bind the properties of the user control that you need.
The DataList will create the "array" of user controls automatically.
The setup of the user control should be done by the user control itself as
soon as its properties are assigned.
Whether it is in a template, or just in a page by itself, should not make a
difference.
--
Riki
Ahh...I think I've got it. I was creating my own array, but so was
asp.net...that' s the reason all my objects were not initialized...t hey were
asp.net's objects (not the ones I created).
It's sort of a complex algorithm to set the user control properties. Can I
call a protected method from the datalist <ItemTemplate >, passing it the
asp.net object, and then let my method set the specific values?
Thanks.
Amil
"Riki" <ri**@dontnagme .comwrote in message
news:OE******** ******@TK2MSFTN GP06.phx.gbl...
Amil Hanish wrote:
>I want to create a bunch of like user controls and display them in a DataList.
Does anyone have a GOOD example of how to do this?
I thought I had it...I added the user control to my <ItemTemplate >, created an array of user controls in my code behind and set the DataSource and called DataBind. But, all the user controls are unitialized when the page is rendered.
Amil
Just put the user control in the template like you would do with any other
control (e.g. a textbox).
Bind the properties of the user control that you need.
The DataList will create the "array" of user controls automatically.
The setup of the user control should be done by the user control itself as
soon as its properties are assigned.
Whether it is in a template, or just in a page by itself, should not make
a difference.
--
Riki This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Roman |
last post by:
I have built a simple user control that contains 2 buttons, a text box and a
dropdownlist. When a button is clicked it sets the visible property
of the textbox/dropdownlist and the button. ie the buttons allow me to
toggle between the textbox and the dropdownlist. This works fine when the
control
is placed on the page but when it is placed inside a datalist, ie the
itemtemplate, the onclick events for the buttons fire but the visibility...
|
by: Scott Schluer |
last post by:
Hello,
I've got myself a small problem and I'm hoping someone can help.
I have a DataList called dlProducts (displays products from a database).
Within the <ItemTemplate> container of the DataList, I have a PlaceHolder
control called phVariations. During the ItemDataBound event for dlProducts,
I dynamically create a few DropDownLists (again, from a database) and .Add
the DropDownList to the PlaceHolder control. That all works just...
|
by: bill yeager |
last post by:
I have a radiobuttonlist inside a datalist. I also have a
datagrid inside the datalist. The data and the controls
are rendering just fine. However, I need to find these
controls inside the datalist in order to programatically
perform some logic.
I have the following in my HTML which is inside the
ItemTemplate of the datalist:
|
by: V. Jenks |
last post by:
What seems like a simple thing is apparently not so
straightforward?
I have a datalist.
Inside of that datalist is an <itemtemplate> secion which
contains other server controls such as a label, a
radiobuttonlist, etc.
I'm driving myself insane trying to figure out how to get
|
by: Davids |
last post by:
having a 100% working aspx page I wanted to create a user control from a
small DataList section (which has an ID="DataList1") of the page, so I
created an ascx file with the DataList and Register the control as should be
done. Now the DataList1 can't be found any more:
The name 'DataList1' does not exist in the current context
why's that??
| |
by: Roman |
last post by:
I have built a simple user control that contains 2 buttons, a text box and a
dropdownlist. When a button is clicked it sets the visible property
of the textbox/dropdownlist and the button. ie the buttons allow me to
toggle between the textbox and the dropdownlist. This works fine when the
control
is placed on the page but when it is placed inside a datalist, ie the
itemtemplate, the onclick events for the buttons fire but the visibility...
|
by: Hans Merkl |
last post by:
Hi,
I am trying to use a user control as EditItemTemplate in a DataList. It
loads fine but I can't figure out how to bind to the data of the DataList.
Here is what I have got so far:
//Page_load of my user control
protected void Page_Load(object sender, EventArgs e)
{
IDataItemContainer DataContainer = this.Parent as
|
by: yoknows |
last post by:
Hello .Net Gurus. This is my first post here so I apologize in advance
if I have not provided the right information. I hope someone has seen
this problem before and can tell me what I am doing wrong. I have
simplified the problem with the following example:
Using asp.net 2.0, I have a Master page template used on default.aspx.
>From within the Content tags on that page I placed a Datalist. It is
iterating a User control "Inner" with...
|
by: Salim |
last post by:
Hi,
I'm trying to get UniqueID of a linkbutton.
I have 2 web user controls.
And a master page.
In fisrst web user control there is a datalist.
In datalist ItemCreated event, I try to find a linkbutton control which is
in the second web user control and in another datalist.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |