473,787 Members | 2,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can't find controls in datalist

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:
<asp:RadioButto nList id="Radiobutton list" runat="server"
OnSelectedIndex Changed="rblRad ioButtonList_Se lectedIndexCh
anged"
RepeatDirection ="Horizontal " AutoPostBack="T rue">
<asp:ListItem Value="1">Waive All
Conditions</asp:ListItem>
<asp:ListItem Value="0">Don't Waive Any
Conditions</asp:ListItem>
</asp:RadioButton List>


I have an event set up which comes into the following
code-behind handler with the debugger after I click one
of the radio buttons.
Protected WithEvents RadioButtonList Hdr As RadioButtonList

..

..

..

Public Sub rblRadioButtonL ist_SelectedInd exChanged(ByVal
sender As Object, ByVal e As System.EventArg s) Handles
RadioButtonList Hdr.SelectedInd exChanged

'Capture the postback event from the
radiobuttonlist

Dim rblConditions As RadioButtonList = DirectCast
(FindControl("R adiobuttonlist" ), RadioButtonList )

Dim dgChild As DataGrid = DirectCast(Find Control
("DataGrid3" ), DataGrid)

Dim chkCondition As CheckBox = DirectCast
(FindControl("C ondition3"), CheckBox)

Dim lblLockNumber As Label = DirectCast
(FindControl("L ockNumber3"), Label)

Dim lblConditionDet ailID As Label = DirectCast
(FindControl("C onditionDetailI D3"), Label)

Dim lblLoanID As Label = DirectCast(Find Control
("LoanID3"), Label)


How come I cannot find any of the controls??? I'm very
stumped with this if someone can PLEASE help........
Nov 18 '05 #1
1 3628
More simply put, how do I access child controls that
reside in the ItemTemplate section of the datalist???

There's GOT to be a way where I can access those controls
outside of the ItemDataBound event of the datalist.....
-----Original Message-----
I have a radiobuttonlist inside a datalist. I also have adatagrid 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:
<asp:RadioButt onList id="Radiobutton list" runat="server"
OnSelectedInde xChanged="rblRa dioButtonList_S electedIndexC hanged"
RepeatDirection ="Horizontal " AutoPostBack="T rue">
<asp:ListItem Value="1">Waive All
Conditions</asp:ListItem>
<asp:ListItem Value="0">Don't Waive Any
Conditions</asp:ListItem>
</asp:RadioButton List>


I have an event set up which comes into the following
code-behind handler with the debugger after I click one
of the radio buttons.
Protected WithEvents RadioButtonList Hdr As RadioButtonList
..

..

..

Public Sub rblRadioButtonL ist_SelectedInd exChanged(ByVal
sender As Object, ByVal e As System.EventArg s) Handles
RadioButtonLis tHdr.SelectedIn dexChanged

'Capture the postback event from the
radiobuttonlis t

Dim rblConditions As RadioButtonList = DirectCast
(FindControl(" Radiobuttonlist "), RadioButtonList )

Dim dgChild As DataGrid = DirectCast(Find Control
("DataGrid3" ), DataGrid)

Dim chkCondition As CheckBox = DirectCast
(FindControl(" Condition3"), CheckBox)

Dim lblLockNumber As Label = DirectCast
(FindControl(" LockNumber3"), Label)

Dim lblConditionDet ailID As Label = DirectCast
(FindControl(" ConditionDetail ID3"), Label)

Dim lblLoanID As Label = DirectCast(Find Control
("LoanID3"), Label)


How come I cannot find any of the controls??? I'm very
stumped with this if someone can PLEASE help........
.

Nov 18 '05 #2

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

Similar topics

1
10930
by: bill yeager | last post by:
I have a datagrid control within a datalist control. When I try and do a "Find" on the control, the object comes back with nothing and then my pgm crashes. I am 100% sure that my datagird inside my datalist has an id of "Datagrid3". dgChild comes back with "Nothing" while debugging. Here is my code in the itemdatabound event for the datalist: <code>
1
1756
by: bill yeager | last post by:
I did some more debugging and found the following: 1) I placed the following code in the button event just to see if I could cycle thru the datagrid control collection: <code> Dim strhello As String Dim myDataListItem As DataListItem Dim myDatagridItem As DataGridItem Dim myCheckBox As CheckBox
2
8737
by: Chris Fink | last post by:
This should be relatively simple but I am unable to find an asp:button tag in a datalist footer. I have tried it numerous ways including the FindControl method from the many events that the DataList exposes and the result is always null (I've determined the OnItemDataBound event will not find the footer controls). I understand that I have to navigate the datalist object tree, but I feel like it is a guessing game and am hesitant to do it...
10
1501
by: Nathan Sokalski | last post by:
I have a DataList control with an EditTemplate. Three of the controls in this template include a Calendar, a Button with CommandName="update", and a Button with CommandName="cancel". Whenever I click one of these controls, the DataList replaces the EditTemplate with the ItemTemplate. I think this is because the method I wrote which performs the databinding is getting called, but I don't know why or where it is getting called from. It does...
5
1914
by: Just Me | last post by:
Given a button name Btn_5 and Index=5 I want to do something like dim zz as string = Btn_??Index??.Text or given an array of buttons, do:
3
1703
by: Jon Paal | last post by:
how do I load controls to the templates for the DataList control. <asp:datalist id="dl1" runat="server" > <ItemTemplate> " how to load control(s) here ????" </ItemTemplate> </asp:datalist>
0
1470
by: HP | last post by:
Hi there I have a datalist control with some bound controls in its Item Template and a gridview bound to one of those fields (residing also in Item Template). I've found out that when I click Edit on the gridview (same happens when editing other gridview which is outside the datalist) all datalist bound fields (except the gridview) disappear, and they don't appear after submitting GV changes - they do only after changing value of some
1
25008
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.
0
1255
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I am having this problem. I have this datalist and whenever I expand the datalist by the plus button, it overlaps other controls on my web page and sometimes these controls come over the dataList. Bleow is the code <table width="100%"> <tr> <td>
0
9655
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
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10169
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...
0
8993
agi2029
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...
1
7517
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
6749
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
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
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.