473,703 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem "seeing" unbound checkboxes in nested gridview

3 New Member
I have unbound checkboxes in a nested gridview to allow multi-selection of "child" rows. For context, the parent gridview rows are for large "reports", the child rows are for various specific files comprising each report. I want the user to be able to select an arbitrary collection of report files and have them emailed by clicking an "Email selected files" button.

Everything displays properly, including the checkboxes for each child row (each file), but on postback (after clicking the "Email selected files" button), I cannot "see" any child rows when iterating through the rows of the parent gridview. What's odd is that I can see the nested (child) gridview as a GridView object that has the correct number of columns, the correct column headings, the correct DataSourceID, etc..., but this nested gridview's rowcount is always zero.

I have read lots of posts on how to create nested gridviews, and that doesn't seem to be the problem. I am setting the nested gridview's datasource in the parent gridview's RowDataBound event. I can successfully manipulate the nested gridview (e.g., making some columns invisible) in the parent's PreRender event. And as I said, the display renders perfectly. The problem is that on post-back, I can't seem to actually find and act on the selected (checked) checkboxes...

Elsewhere, I have successfully implemented unbound checkboxes in a gridview and processed them in a button click event handler when no nesting is involved, so my current effort has been to adapt that approach for the nested gridview. Here's the button click handler that I have created and expect to be "seeing" the checkboxes, but it's not:

Protected Sub cmdEmailSelecte dFiles_Click(By Val sender As Object, ByVal e As System.EventArg s) Handles cmdEmailSelecte dFiles.Click
' NOTE: parent gridview is named gvDocsAndRpts; child gridview is named gvDocFileSelect
Dim r1 As Integer
Dim r2 As Integer
Dim nestedGV As GridView
For r1 = 0 To gvDocsAndRpts.R ows.Count - 1 ' this works - it iterates the correct number of times
If (gvDocsAndRpts. Rows(r1).RowTyp e = DataControlRowT ype.DataRow) Then
nestedGV = CType(gvDocsAnd Rpts.Rows(r1).F indControl("gvD ocFileSelect"), GridView)
For r2 = 0 To nestedGV.Rows.C ount - 1 ' this doesn't work - nestedGV.Rows.C ount is always zero
If CType(nestedGV. Rows(r2).FindCo ntrol("chkToEma il"), CheckBox).Check ed Then
' code to handle a checked child row
End If
Next n
End If
Next r
' additional processing...
End Sub

Any help very much appreciated. Cheers,

Chris
Mar 6 '08 #1
2 2824
GISmatters
3 New Member
Quick amendment: I lightly edited the code I posted to focus it, but in the process I renamed the loop variables and forgot to rename them at the bottoms of the loops... rest assured the real code doesn't have that error, and that is not the explanation for my problems...
Mar 6 '08 #2
GISmatters
3 New Member
Problem resolved.

The problem was due to viewstate being disabled on the parent gridview. I had disabled viewstate long ago and was adding the nested gridview as a new feature - it didn't occur to me to even think about viewstate, in part because I could see some of the information about the nested gridview... of course, in hindsight I realize that the information I could see is all the static properties specified in the .aspx file.
Mar 7 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
14249
by: Hank | last post by:
I have two SQL Server 2000 machines (server_A and server_B). I've used sp_addlinkedserver to link them both, the link seems to behave fine. I can execute remote queries and do all types of neat things from one while logged onto the other. I'm working on a project to keep the data in the two systems synchronized, so I'm using triggers on both sides to update each other. For testing, I've created a simple, one-column table on both...
8
7154
by: L Major | last post by:
Hi Unfortunately, I am limited to using tables for part of my current project. I have a form that spans across a number of TR and TD in the shape of checkboxes. Doctype is XHTML 1.0 Transitional, Encoding is utf-8 Is there anything wrong? Should I try something else? What in that case?
3
6468
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I COULD be wrong... :) I've tried the access group...twice...and all I get is "Access doesn't like ".", which I know, or that my query names are too long, as there's a limit to the length of the SQL statement(s). But this works when I don't try to...
46
2249
by: TTroy | last post by:
Hi, I'm just wondering why people/books/experts say "the function returns a pointer to.." or "we have to send scanf a pointer to.." instead of "the function returns the address of.." or "we have to send scanf the address of.." Isn't the lvalue called a POINTER TO and the (r)value called the ADDRESS OF?
2
3689
by: Questman | last post by:
Good afternoon, Does anyone have any code that implements, or approaches implementing, a cross-browser DHTML/JS solution to provide an Excel-like Grid on a web page - I'm trying to convert an old Java client/server data maintenance program to the web - the main display is in a grid format, which allows the user to select multiple rows and edit them in a new grid, which processes each grid line individually and validates and saves the...
10
5302
by: NH | last post by:
I have a girdview with paging enabled. How can I add a message in the footer to say "Viewing records 1-15 of 45" etc Thanks
1
3878
by: scartin | last post by:
I'm fairly new to working with ASP web controls, and am running into what seems to be a ridiculous problem that I'm hoping will be a breeze for an experienced ASP developer. I have a GridView and a FormView on the same page, where the GridView is visible at page load, and the FormView is set to Edit mode by default, but is hidden on the page. I have the Select link enabled on my GridView, and I use the SelectedIndexChanged event to hide...
3
7700
by: Darin | last post by:
I have a problem I just can't figure out. I have a form with a subform, and the recordsource of the subform has criteria based on some unbound fields in the parent form so that data in the parent form affects data in the subform. I've had this type of setup often, but I've run across a couple forms where this has caused an "enter parameter value" pop up for each reference to the parent control in the query when the main form is closed. ...
0
940
by: =?ISO-8859-1?Q?Luis_M._Gonz=E1lez?= | last post by:
I apologize for this very basic question, but I can't understand how this works... I want to import a function from module B into my main script A, so this function can see and use the locals from A. For example: def auto(): urls = for k,v in __main__.locals().items(): # these "locals"
0
8669
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9251
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
9121
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...
1
9017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7867
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...
0
5922
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();...
1
3123
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
2
2450
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.