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

FindControl on GridView Cell returning null

Group,

This is the problem I am facing (VS2005):

- I do a GridView1.DataSource = DataTable and GridView1.DataBind()
- then I add checkbox coltrols to a selected few cells of the GridView:

CheckBox cb = new checkBox();
cb.ID = "cbSelect";
GridView1.Rows[j].Cells[k].Controls.Add(cb);

Every thing works fine and I am able to see the checkboxes on screen.
The user is suppose to select the checkbox, which ever is applicable
and is suppose to click a button for further processing.

On click of the button, I try to fetch the checkBoxes by doing
FindControl on the appropriate cells:

CheckBox cb =
(CheckBox)GridView1.Rows[j].Cells[k].FindControl("cbSelect");

But I always get cb as null. Any idea what might be wrong here ?
Yes, on button click, I check for the controls *before* reassigning the
datasource again.

saha
--

Jun 25 '06 #1
0 1278

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

Similar topics

3
by: clintonG | last post by:
Briefly stated, my problem is accessing and 'setting' properties of a label control declared in the template of another control noting that the other control is an instance of the beta 2...
0
by: George Durzi | last post by:
cross posted in datagrid group. Inside <columns/> in my datagrid, I have the following template column <asp:templatecolumn HeaderText="To Be Completed By"> <itemtemplate> <asp:Label...
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: Martin | last post by:
Hi, I have a very frustrating problem that I have researched for countless hours to no avail. There are many posts asking very similar things, however none usefull in my situation. I am using VS...
1
by: Jon S via DotNetMonster.com | last post by:
HI all, I'm returning a dataset to a gridview control. When the gridview asp.net control is populated from the returning dataset some of the cells remain empty. This is expected as some data...
2
by: kevin | last post by:
Hi. I'm ripping my hair out. I'm in VS 2005 Framework 2. I have one website with a gridview with some template fields. I'm using the footer row to insert records. For this discussion there is a...
14
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I have created a UserControl ("MyUC"). I've put a bunch of instances of that control on a Page ("Defaul.aspx"). The control works fine. Now, I want to be able to use "FindControl()" from...
14
by: Mike | last post by:
I have a gridview that has a button in the last cell of each row. I want to get the text from cell 1 for that row the button was clicked on. So if my gridview looks like this: N-12 BMW ...
2
by: Bart | last post by:
Hi, i need to check wether a cell of a gridview is empty or not. I did this: Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.