473,659 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re-Use the asp:ObjectDataS ource control

Does anyone know how to re-use the asp:ObjectDataS ource control?

What I want to do is add ONE asp:ObjectDataS ource control to my Web form,
then BIND it to MULTIPLE DropDownList boxes in the Code Behind, since the
DropDownList boxes will all reference the same Stored Procedure. However,
you can not do that since that ObjectDataSourc e is already bound to another
control on the form. The only way I know to do this is to add multiple
asp:ObjectDataS ource controls to the form with their own unique ID, which
seems redundant if all the ObjectDataSourc es will use the same store
procedure with the same parameters.

In the Code Behind, how can I create a NEW instance of the
asp:ObjectDataS ource control for each of the DropDownList boxes I want to
BIND to?
Jul 10 '08 #1
0 1137

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

Similar topics

5
3470
by: Trail Monster | last post by:
Ok, I've been searching the net now for several days and can't find how to do this anywhere. Version: VS 2005 Professional Release, 2.0 Framework Background: I have a complex business object Employee that contains public properties and several nested objects such as a Spouse object and a List of Coverage objects.
2
8176
by: Nir.Hazan | last post by:
When I try to update my GridView I get the error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters: CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry, original_OrderID. Details: VS2005 C# website. GridView is bound to a ObjectDataSource1.
2
3782
by: Ian | last post by:
Hiya, Hope this isn't too stupid a question :) I can bind an objectdatasource to a gridview very easily (and there's a thousand tutorials of this on the net). BUT! I just want to get at the data so I can say put it in a label.text, or
7
3451
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function 'UpdateRegistrant' expects parameter '@EMail', which was not supplied. The field value was null in the database and not changed in the FormView so is null going back into the stored procedure. I'm stumped and would greatly appreciate any suggestions.
3
3544
by: Jeronimo Bertran | last post by:
I have a FormView that shows details of a specific record on a table. The SelecMethod returns a DataSet that includes all the fields from my Event table and other read-only fields from linked tables. My FormView has controls that are bound to the fiuelds on the dataset table. I am now changing the FormView's Default Mode to Edit but I am having problems with the related fields. My ObjectDataSource is defined as: ...
3
5296
by: siamesedream | last post by:
Hello, I'm having trouble using the insert method of an ObjectDataSource that uses a custom DataObjectType. If I'm using a custom DataObjectType does my insert method have to take that object, i.e. myInsertMethod(MyCustomObjectType foobar) or can I actually specify parameters to the insert method via the InsertParameters collection associated with the ObjectDataSource, i.e. myInsertMethod(string name, int age). Doing the latter I keep...
1
2946
by: Tina | last post by:
I have an .XSD tableadapter whose GetData takes an int.32 argument. I created an ObjectDatasource that uses the .XSD to retrieve the data. When creating the ObjectDataSource it recognized that an Int32 argument was needed. but in the code I can't see how to specify the parameter to the ObjectDataSource. I can't find an example anywhere. I tried odsRFranOrder.SelectParameters.Add("OrderID", System.TypeCode.Int32, orderid); where...
4
20891
by: GaryDean | last post by:
I have an objectdatasource reading a dataset and I have a gridview using that objectdatasource (at design time). It binds fine but I need to clear it. myGridView.DataSource = null: myGridView.DataBind(); does not work! There is no clear method for the ODS. How do I get rid of it?
4
7073
by: Sean | last post by:
I'm dynamically creating PDFs and trying to create an objectdatasource completely in the code behind, but I can't figure out how to call the selected event. Here's what I have so far... string App1ID = 1234; ObjectDataSource Appendix1 = new ObjectDataSource(); Appendix1.TypeName = "Appendix1BLL"; Appendix1.SelectMethod = "GetAppendix1ByAppendix1ID"; Appendix1.SelectParameters.Add("Appendix1ID", App1ID); Appendix1.Select();
5
3203
by: J055 | last post by:
Hi I've got an update business object method which takes about 80 parameters. I'm getting the 'could not find a non-generic method' error. I know that the ObjectDataSource UpdateParameters matches the business object method signiture. I ran the code below to discover that the InputParameters is in fact a list of bound values in my FormView control, i.e. not the UpdateParameters list. protected void ObjectDataSource_Updating(object...
0
8428
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
8851
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...
1
8539
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,...
1
6181
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
5650
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
4176
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...
0
4342
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2759
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
1982
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.