473,770 Members | 5,976 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP 2.0 Problem with Nesting User Control containing a GridView within a DataList

My page layout is like this:

Page
DataList (databound using ObjectDataSourc e1 contained in page)
Items
UserContro l
GridView (databound using another ObjectDataSourc e2 contained in UserControl)


So I've basically got a GridView (wrapped in a UserControl), that is
nested within a DataList. Representing a fairly simple relational data
structure (see bottom of post).

In ASP 1.x I would then pass the ID's that are required to lookup the
GridView data to the child UserControl in the DataList_ItemDa taBound
event in order for it to know what to render.

Attempting this in ASP 2.0 gives me problems, because when the
UserControl is created by the datalist, it automatically invokes the
GridView's databinding (straight after the Page_Load of the
UserControl) BEFORE the ID's needed to perform the rowset lookup have
had a chance to be passed in by the parent DataList.

If I do this without the UserControl, it works (i.e. if I put
ObjectDataSourc e2 and the GridView directly into the parent DataList).
But this obviously isn't what I want!!

Has anybody got any ideas on how to get back the control that has
seemingly been taken away from me?

Surely it's possible to stop this automatic databinding from
happening?!!

FYI Data Structure:

There are three main tables related to this scenario:

ServiceTypes (PK ID)
Services (PK ID, FK ServiceTypeID)
UserServices (PK GUID, FK ServiceID, UserGUID)

The DataList is bound to the ServiceTypes table with no filter (via
ObjectDataSourc e1).
The ServiceTypes PK (ID) is passed to the UserControl (along with a
UserGUID), to perform the following filter on the UserServices Table
(via ObjectDataSourc e1):

"[UserGUID] = '" & uiUserGUID.ToSt ring & "' AND
Parent(Services ServiceUsers).[ServiceTypeID] = " &
iServiceTypeID. ToString

Both ObjectDataSourc es are pointing to a custom business object that
I've written to wrap & manage a strongly typed dataset (another thing
I've had to resort to in order to get this stuff to work properly, as I
can't seem to get anywhere by binding directly to it!!!)


I'm really trying to give all these new databinding controls the
benefit of the doubt, but I keep coming across major restrictions
whichever way I turn. It's obviously very simple to set up a basic grid
for editing a flat table, but nearly all of the scenarios I come across
are so much more complicated than that, but seem to be much more
difficult to do than ASP 1.x, within the confines of the new
databinding structure of ASP 2.0!

Dec 6 '05 #1
0 1706

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

Similar topics

1
3343
by: Glenn Owens | last post by:
Here's the scenario: I have a DataList populated from a datatable sitting inside a fieldset. Each element (row) in the Datalist has the following child controls: asp:checkbox, asp:image, asp:labels. Within the <form>, but outside the fieldset, containing the datatlist, I have a usercontrol (used to collect search criteria) and some asp:button controls (used to initiate actions - ie. retrieve db data, reset user control fields,...
0
1654
by: manu_srinivasa | last post by:
:( Here is my design, we have user control placed in a aspx page. within user control, i am having datalist, within datalist i am placing radio button. On click of radio button, i need to know the seleceted row of the datalist. radiobutton checkchanged event is not firing.
2
2309
by: Roman | last post by:
I have built a simple user control that contains 2 buttons, a text box and a dropdownlist. When a button is clicked it sets the visible property of the textbox/dropdownlist and the button. ie the buttons allow me to toggle between the textbox and the dropdownlist. This works fine when the control is placed on the page but when it is placed inside a datalist, ie the itemtemplate, the onclick events for the buttons fire but the visibility...
9
13906
by: Jakob Lithner | last post by:
1) I have a DataGridView with edit capability. But in some columns I want to limit the input with a DropDownList. There is no inbuilt column for DropDownLists so I intended to add one myself. I thought the TemplateField would be a good candidate so I added a DropDownList in the EditItemTemplate and a Literal in the ItemTemplate, but then I was kind of lost .... It would be convenient to use the DataGridView for all other fields but maybe...
3
17116
by: Dabbler | last post by:
I have a checkbox control in a GridView EditItemTemplate. My SqlDataAdapter complains when I try and use UpdateCommand Thanks on any binding clarification. GridView: <asp:TemplateField HeaderText="Active"> <ItemTemplate> <asp:CheckBox ID="ActiveCheckBox" runat="server" Checked='<%# Eval("Active") %>' />
0
2417
by: John Smith | last post by:
ASP.Net 2.0 / C# / IIS 6 I have 2 pages. The master page consists of a tabbed menu created using the Menu and MultiView controls. Something like this: http://fredrik.nsquared2.com/viewpost.aspx?PostID=344&showfeedback=true The second page is a user control that contains a GridView control linked to a database table. What's supposed to happen is that the user clicks on a menu choice and an appropriate user control will load. For...
3
5261
by: igotyourdotnet | last post by:
I'm using a gridview and I have it formatted using sub headings. now I need to get totals for each sub heading. Is this possible? example: BMW (sub heading) 25,000 14,252 25,000 total: 64,252
5
2345
by: Josh Nikle | last post by:
I have a webform containing a GridView control "GridView1" and usercontrol which is also a GridView "GridView2." I have a button column in the usercontrol. The code behind that button adds an entry to my database, which it's doing fine, but I can't get GridView1 to show the updated data unless I browse to another page and then come back. I've been reading about using java script to accomplish this, but I must be doing something wrong....
1
25007
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
10230
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
10058
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
10004
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
9870
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
6678
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
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3972
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
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
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.