objectdatasource

ASP.NET ObjectDataSource Binding Automatically to Repeater - Possible?

Hi, I have a Question class: class Question { public int QuestionNumber { get; set; } public string Question { get; set; } public string Answer { get; set; } } Now I make an ICollection of these available through an ObjectDataSource, and display them using a Repeater bound to the DataSource. I use <%#Eval("Question")%> t...

Using generic classes with ObjectDataSource

I have a generic Repository<T> class I want to use with an ObjectDataSource. Repository<T> lives in a separate project called DataAccess. According to this post from the MS newsgroups (relevant part copied below): Internally, the ObjectDataSource is calling Type.GetType(string) to get the type, so we need to follow the guideline do...

ObjectDataSource Update method with dynamic parameters

Hi! I have this DataTable that has a varying set of columns except for a sequence number. | Sequence | Value | Tax | Duty | Total | Any number of columns should be accepted with unique column names. To display that table, I need to use an ObjectDataSource mapped to a presenter class with a Select method. class Presenter { [Data...

Type 'System.Web.UI.WebControls.SessionParameter' does not have a public property named 'DbType'.

I am using a Session Parameter on an ObjectDataSource. It works fine on the local development machine but I get this error after copying the website to the production server: Type 'System.Web.UI.WebControls.SessionParameter' does not have a public property named 'DbType'. ...

ASP.NET - ObjectDataSource: using multi-select ListBox as ControlParameter

Hello, I have a form that contains a GridView control which is databound to an ObjectDataSource Control. There are several TextBox controls that are already being used as ControlParameters for the ObjectDataSource. I also have a custom data object that the ObjectDataSource is associated with {TypeName="myDataClass"}. The values are pass...

How do I set up ObjectDataSource select parameters at runtime

I'm trying to add parameters to an objectDataSource at runtime like this: Parameter objCustomerParameter = new Parameter("CustomerID", DbType.String, customerID); Parameter objGPDatabaseParameter = new Parameter("Database", DbType.String, gpDatabase); //set up object data source parameters objCustomer.Se...

GridView/ObjectDataSource inside runat=server container does not bind

I've got a small web form with 2 radio buttons, call them PickFromList and EnterValue. When PickFromList is checked I want to show a GridView that I've configured to bind to an ObjectDataSource. When EnterValue is checked I want the GridView to disappear. This form is laid out using a table and want to hide/show the appropriate rows b...

VS2008 ObjectDataSource throws Exceptions

I am working on an ASP.NET page with a GridView and an ObjectDataSource. I want to configure the ObjectDataSource against a class (decorated with DataObject()) in my business layer. A class amonst many others set up in a very similar fashion. I select the class and click Next to pick the function for the SelectMethod and it closes wit...

How to properly set a datatable to an gridview in code with an ObjectDataSource?

Hello, I have an ObjectDataSource with an ID of ObjectDataSource1 on a webpage. I also have a gridview in which I am binding the ObjectDataSource.ID to the GridView.DataSourceID. The problem I get is when text is changed in a textbox, the code calls BrokerageTransactions.GetAllWithDt which returns a DataTable. I want to set this data...

ObjectDataSource and Collection of Objects

I have a GridView that I would like to bind to an ObjectDataSource. I have a ReadOnlyCollection of business objects that have many properties. I only to need to display four of these properties in the GridView. I haven't used the ObjectDataSource control before, so how can I use it to display 4 properties of all of the business object...

Proper ObjectDataSource Use

Greetings! I'm creating a User Control that will display data in a GridView control. We are using n-tier architecture and the data in question is retrieved from our database and returned to us as a ReadOnlyCollection. OurNewObject is a class containing several properties and an empty constructor that takes no parameters - it's in the ...

.NET Designtime Datasource (for Combobox)

Hi, i'm trying to create a ObjectDataSource which I can use to bind to a BindingSource which on his turn should be bound to a ComboBox. I've created a simple class and a simple list for this class (see below) The Times list class is not showing up at my toolbox, so I cannot drag it to the form so I can select it as the datasource for...

ObjectDataSource Gridview Insert Fails W/ Empty Values Dictionary

I have a gridview to which I have created an Insert Template in the footer row. I have an ObjectDataSource which is bound to a business object. I have an OnInserting event handler which never gets fired. The program encounters an error once I call .Insert on the ObjectDataSource. The error I receive is that there are no values and th...

Can you get a DataTable from an ObjectDataSource?

Hello, If I have an ObjectDataSource defined at design time, can I get a DataTable from that ObjectDataSource at runtime? I have a method that returns a DataTable that I am using for the Select method property of the ObjectDataSource. ...

ASP.NET 2.0: Specifying an instance of an object for an ObjectDataSource

I'm using an ObjectDataSource to bind data to a GridView; it works fine except that it always creates a new object to use as a data source. I can do all the setup just fine but I cannot use an instance of an existing object to specify as the "data source" for it. Is it possible to do this? If so, how? If it's not possible, why? ED...

Using Linq for ObjectDataSource: How to transform datetime using ToShortTimeString?

I am accessing a business class using an ObjectDataSource and trying to produce output that makes sense to the user. The return values describe a Class (as in Classroom and teaching, not software). I would like to show the time of the class as a range like this: "9:00 AM - 10:00 AM". This is the Linq Query I am using to pull the data:...

ObjectDataSource caching on large static result set

Hi, I have an objectdatasource that will return a potentially large collection (up to 200,000 records) that are bound and paged in a gridview. I am using default paging and caching on the objectdatasource. The data being returned is only updated weekly so stale data is not an issue. The paging in this solution was also faster than w...

Paging & Sorting grids with ASP.Net MVC

I'm new to MVC, and am not following how you'd do paging and sorting on a grid. I'm used to using the asp.Net GridView control with an ObjectDataSource pointed at objects in our business layer - and in that case the ODS handles all of the paging & sorting using the methods that our ORM generates on the objects. I've looked at using the...

Linq to SQL null values in GridView

Normally if I'm linking an ObjectDataSource to a GridView and I have a TemplateColumn that has an Eval in it and it's Null, I can just put a ".ToString()" it works fine. For some reason, this doesn't work the same when you're using Linq to SQL. I originally was using XSD files for my DAL with a custom BLL. I tied it to the GridView wi...

Gridview disappears on postback when paging is enabled.

I have a gridview that has its DataSourceID property set to a custom ObjectDataSource object. When AllowPaging is set to True, the GridView disappears after a postback. If I set AllowPaging to False it's fine. Can someone shed some light on this for me? :) Edit: The other thing I'm confused about is I thought that if you set the DataSou...