473,671 Members | 2,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

findcontrol to find in nested datalists

I need to access the properties of a control that is nested in 2 datalists.
How do you use findcontrol method to do that?

what I have is like this:

<asp:datalist id="dlist" runat="server">
<edititemtempla te>
<asp:datalist id="dlistdet" runat="server">
<asp:dropdownli st id="ddlTypes" runat="server"> </dropdownlist>
</asp:datalist>
</edititemtemplat e>
</asp:datalist>
Every thing loads fine. The ddlTypes is loaded from a database and I
can see it's results. I need to access the selected value on it
directly. I am able to access a control from within the first dlist by
using:

neededitem = CType(e.Item.Fi ndControl("cont rolname"), TextBox)

But what is the syntax to drill down further into that edititemtemplat e
and the dlistdet? Also, I am running this from the event
SelectedIndexCh anged
on the dropdownlist, and I dont have the e.item.findcont rol. what I am
trying is something like this:

Dim ddl As DropDownList =
CType(dlist.Ite ms(dlist.Select edIndex).FindCo ntrol("ddlTypes "),
DropDownList)

But that isnt working. Not sure what it's supposed to look like.

Thank you for the assistance!

Greg Fischer
1st Byte Solutions
http://www.1stbyte.com
Nov 18 '05 #1
2 2163
Hi Greg:

You are using this from the SelectedIndexCh anged event? If so, the
sender parameter is the DropDownList control, you'll just need to
CType it into a DropDownList and then start party.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 15 Nov 2004 15:57:37 -0800, Greg Fischer
<bb******@1stby te.net> wrote:
I need to access the properties of a control that is nested in 2 datalists.
How do you use findcontrol method to do that?

what I have is like this:

<asp:datalis t id="dlist" runat="server">
<edititemtempla te>
<asp:datalist id="dlistdet" runat="server">
<asp:dropdownli st id="ddlTypes" runat="server"> </dropdownlist>
</asp:datalist>
</edititemtemplat e>
</asp:datalist>
Every thing loads fine. The ddlTypes is loaded from a database and I
can see it's results. I need to access the selected value on it
directly. I am able to access a control from within the first dlist by
using:

neededitem = CType(e.Item.Fi ndControl("cont rolname"), TextBox)

But what is the syntax to drill down further into that edititemtemplat e
and the dlistdet? Also, I am running this from the event
SelectedIndexC hanged
on the dropdownlist, and I dont have the e.item.findcont rol. what I am
trying is something like this:

Dim ddl As DropDownList =
CType(dlist.It ems(dlist.Selec tedIndex).FindC ontrol("ddlType s"),
DropDownList )

But that isnt working. Not sure what it's supposed to look like.

Thank you for the assistance!

Greg Fischer
1st Byte Solutions
http://www.1stbyte.com


Nov 18 '05 #2
Ah, yes! That's right. thanks!

this was it...

Public Sub cmbAddType_OnSe lect(ByVal s As System.Object, ByVal e As
System.EventArg s) Handles cmbAddType.Sele ctedIndexChange d

Dim ddl As DropDownList = CType(s, DropDownList)

From there I have all the properties!

Cool!
Nov 18 '05 #3

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

Similar topics

1
7759
by: James G. Beldock | last post by:
I have seen the following behavior: when issuing a Page.FindControl() for a control which exists in an item template (from within an ItemDataBound() event, for example), I get nulls back regularly. Has anyone seen this before? It's pretty aggravating to have to iterate through the controls in each grid cell to find the ones I need, especially since finding those cells is not always easy. Here's my ItemDataBound() handler: private void...
3
1385
by: Andrea Williams | last post by:
Ok, thanks to a kind person yesterday, I've started using the FindControl() method. Although I able to get this to work for Web Controls, I'm unable to find the HTML Controls? Am I missing something still? Do I really have to use the Web controls in order to be able to change properties on the control? I'm trying to create a user control and have the apsx page include that control, but change a few properties, like the Table Border...
0
1212
by: Marty U. | last post by:
I have two datalists nested. On the ItemDataBound Event of the first datalist I databind the second with specific info. A couple questions: 1) How can I utilize the OnItemCommand of the nested datalist(inner) to retrieve the DataKey value when a user clicks a link button? 2) Is there anything I should be concerned with about ViewState? This is a reporting tool and no input is accepted. I have found a couple examples but none pointing...
1
965
by: ad | last post by:
I find a interesting method of page: FindControl. When we need to use it?
5
1342
by: Sparky Arbuckle | last post by:
The application I'm creating consists of a DataGrid with 3 (at this point in time) DataLists nested inside of it. One of the columns is for the the latest version of the product and the other is for revisions to that produce version. So the database table would look something like this for any given item with revisions: ItemNumber - Revision A - 1 A - 2
5
23295
by: sck10 | last post by:
Hello, I am using the code below to set the values of a DetailsView template field using FindControl. My question is how would you find a control if its a Boundfield control? For example, how would I reference the following BoundField ("NTAccount") in the Sub dvDetail_PreRender sub? Any help would be appreciated... <asp:BoundField DataField="NTAccount" HeaderText="NT Account" />
2
2063
by: jobs | last post by:
I have two Nested repeating Datalists with different data sources. Currently the second Datalist is set to visible=false I have an oncommand button on the first, that when selected I would like to make it's sub datalist visible. I'm a bit confused about how to refrence the instance of the second datalist.
2
2386
by: Ole V.-M. | last post by:
Greetings, i have a UserControl, that contains a DataList. That DataList contains as items other DataLists. example: DataList A Row 1 Nested DataList 1 Row 1
5
4109
by: John Kotuby | last post by:
Hi all, After more than a year programming with ASP.NET 2.0 and VB I am still finding it difficult to leave some habits from classic ASP behind. this is particularly true with cross-page posting. My site uses Master pages and user controls. On an Advanced Search page I have numerous entry boxes and listboxes (keywords, categories, etc.) which are primarily standard HTML. I post this page to a different page which lists results and...
0
8472
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, 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...
0
8819
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 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...
1
8596
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,...
0
8667
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6222
isladogs
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...
0
5690
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();...
0
4221
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...
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1801
bsmnconsultancy
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...

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.