473,326 Members | 2,126 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,326 software developers and data experts.

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">
<edititemtemplate>
<asp:datalist id="dlistdet" runat="server">
<asp:dropdownlist id="ddlTypes" runat="server"></dropdownlist>
</asp:datalist>
</edititemtemplate>
</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.FindControl("controlname"), TextBox)

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

Dim ddl As DropDownList =
CType(dlist.Items(dlist.SelectedIndex).FindControl ("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 2152
Hi Greg:

You are using this from the SelectedIndexChanged 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******@1stbyte.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:datalist id="dlist" runat="server">
<edititemtemplate>
<asp:datalist id="dlistdet" runat="server">
<asp:dropdownlist id="ddlTypes" runat="server"></dropdownlist>
</asp:datalist>
</edititemtemplate>
</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.FindControl("controlname"), TextBox)

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

Dim ddl As DropDownList =
CType(dlist.Items(dlist.SelectedIndex).FindContro l("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 #2
Ah, yes! That's right. thanks!

this was it...

Public Sub cmbAddType_OnSelect(ByVal s As System.Object, ByVal e As
System.EventArgs) Handles cmbAddType.SelectedIndexChanged

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
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...
3
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...
0
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...
1
by: ad | last post by:
I find a interesting method of page: FindControl. When we need to use it?
5
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...
5
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,...
2
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...
2
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
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....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.