473,320 Members | 1,799 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,320 software developers and data experts.

Findcontrol problem

Hi,

I have this inside my asp.net 2.0 page:

Page start code...

<asp:Content ID="content" ContentPlaceHolderID="content1" Runat="Server">
<table>
<tr>
<td id="mytd" runat="server">

... page end code.

How can I get mytd?

I tried this Page.FindControl("mytd") but this did not work. ;-(

Hope someone can help.
Nov 19 '05 #1
2 2728
The FindControl Method works only on the Controls that are immediately
inside the Control Specified. Example:

HtmlTableCell myTd = content1.FindControl("myTd");

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Arjen" <bo*****@hotmail.com> wrote in message
news:dj**********@news1.zwoll1.ov.home.nl...
Hi,

I have this inside my asp.net 2.0 page:

Page start code...

<asp:Content ID="content" ContentPlaceHolderID="content1" Runat="Server">
<table>
<tr>
<td id="mytd" runat="server">

.. page end code.

How can I get mytd?

I tried this Page.FindControl("mytd") but this did not work. ;-(

Hope someone can help.

Nov 19 '05 #2
On Mon, 17 Oct 2005 21:08:24 +0200, "Arjen" <bo*****@hotmail.com>
wrote:

I tried this Page.FindControl("mytd") but this did not work. ;-(


Kevin gave you the correct answer. I have an article that expands on
the "why" part:

In Search Of ASP.NET Controls
http://odetocode.com/Articles/116.aspx

You are using master pages, and master pages are marked with the
INamingContainer interface. The article explains the impact of
INamingContainer on FindControl.

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #3

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

Similar topics

8
by: Adam Billmeier | last post by:
Problem: I am trying to use FindControl to grab a dropdownlist that is in the EditItemTemplate of a Datalist and then Bind it to a dataset. I also then need to put the correct values in all of...
10
by: Terry Olsen | last post by:
I've got a datagrid set up to display data. I've also got an Edit,Update,Cancel column set up to allow editing of data. I've got a DropDownList (ID="ddl3")in the EditItemTemplate for a certain...
2
by: christof | last post by:
How to do it: My page: <asp:DataList ID="dataListRoleMembers" ...> .... <FooterTemplate> <asp:LinkButton ID="btnAddMember" runat="server"...
2
by: encoad | last post by:
Hi everyone, I'm slowly going mad with Masterpages and the FindControl. After a couple days of figuring out how to use the FindControl command from within a Masterpage, I still can't explain...
4
by: Savas Ates | last post by:
I have a datagrid control and in my edit item template tag I have ,
11
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I am trying to get the text of an item in a GridView, but am doing something wrong. Can someone help me with the correct C# statement I need? Below is my GridView and my attempt to get the control....
5
by: daniel.hedz | last post by:
I am generating a usercontrol dynamically successfully, but when I try to find that usercontrol I get a type mismatch. This is what I am doing: //Loading my usercontrol...
2
by: Terry | last post by:
Hi, i want to access control "TextBox1" embedded in another control "LoginView1" in order to change the 'Text' of the textbox. Therefore i use 'FindControl' method but i get error: "Object...
1
by: Dan | last post by:
Hi, I created a custom control (ParentCustomControl) which is using a custom template (implementing ITemplate interface), in the instantiateIn method of this template I create all the controls I...
2
by: Jeff | last post by:
hi asp.net 2.0 I'm having trouble with findcontrol. The problem is in the code below. The is that this line don't work: label = (Label)e.Item.FindControl("lblKode"); label has a NULL value...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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

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.