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

DataGridItem.FindControl()


I'm using this code:

Public Sub DropDown_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs)
Dim list As DropDownList = CType(sender, DropDownList)
Dim cell = CType(list.Parent, TableCell)
Dim item = CType(cell.Parent, DataGridItem)
Dim index = item.ItemIndex
Dim row As DataRow
row = ds.Tables(0).Select("ID = '" + item.Cells(0).Text + "'")(0)
row.Item("Status") = list.SelectedValue
row.AcceptChanges()
If row.Item("Status") = "D" Then
item.FindControl("txtMyText").ReadOnly = False
or
cell.FindControl("txtMyText").ReadOnly = False
or
item.Parent.FindControl("txtMyText").ReadOnly = False

The problem is that DropDownList that triggers above Sub is not in the same
datagrid cell as txtMyText. However, it is in the same row. How can I get
reference on it (txtMyText)? All 3 above FindControl() calls fail with:

[NullReferenceException: Object variable or With block variable not set.]

There are no problems with finding controls that are in the same cell as
DropDownList which triggered above event.
Jun 6 '06 #1
0 1300

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

Similar topics

0
by: Paul Perot | last post by:
Hi All: I am populating a Data Table with File/Folder information from my drive... I am then binding this data table to a DataGrid. Due to the size of the DataGrid data, I use the built in...
2
by: Richard Loupatty | last post by:
I put a datagrid in a panel with an overflow set on auto. I want to show just 5 items in the grid. My question is how to make sure that the selecteditem is always visible in the grid. Because...
4
by: Souri Challa | last post by:
Hello All, When a datagrid in a web form is getting re populated from view state on post back, it is firing the datagrid Item Created event but the DataGridItem(e.Item.DataItem is null) in the...
4
by: tshad | last post by:
Is there a way to get the text from control, without actually defining it? For example, I have a DataGrid that has fields that are either Labels or Textboxes, depending on whether they are in...
1
by: Samuel Chowdhuri | last post by:
this peace of code is giving me trouble DIM i as DataGridItem for each i in myDataGrid checkbox chkbox = Ctype(i.findcontrol("deletethis"),checkbox) if(chkbox.checked) then ...... .....
3
by: GD | last post by:
Got a simple ASPX page (.NET v1.1) with a DataGrid displaying a list of widgets. If the page has a QueryString called WidgetId specific, I need to automatically mark the specific DataGridItem as...
2
by: Mike Gaab | last post by:
VS 2005 What is the difference between the DataGridItem's ItemIndex and DataSetIndex? Aren't they the same thing? Here is what I found on msdn. ItemIndex Gets the index of the DataGridItem...
2
by: John Smith | last post by:
I have this code: <asp:datagrid id="dg1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:TemplateColumn HeaderText="SM"> <ItemTemplate> <asp:Label id="Label2" runat="server"...
3
by: Steve Hershoff | last post by:
Hi everyone, I'm wondering if anyone has a suggestion on how to do this, or if it's even possible. In my datagrid's OnItemDataBound function I'd like to somehow "add" a child row beneath one...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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,...

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.