objectdatasource

If you use a declaritive datasource can you access the dataobject programatically?

I'm using asp.net 2.0. I am using declarative datasources. For some things in the code behind I want access to the object returned by Foo.Bar (In the following example). the system is caching it so I should be able to acces that version instead of having to re-call Foo.Bar(). How do I do this? <asp:ObjectDataSource ID="MyLuckDataSource1...

CheckBoxList with multiple values bound to a single flag enum

I have a FormView (bound to an ObjectDataSource) that contains a CheckBoxList that I'd like to bind to a single property of the underlying object that is an Enum with the FlagsAttribute applied to it. Binding to the SelectedValue property always gives me just the FIRST selected value from the list as the property's value. Anyone know h...

DotNetNuke ObjectDataSource.SelectMethod not being saved in viewstate

I'm using DotNetNuke 4.9.2 and am running into an odd issue. I have a MultiView in the module that I'm developing, and in one of the views have a GridView that is bound to an ObjectDataSource. In a separate view, i have several buttons that will switch the SelectMethod of the ObjectDataSource in the 2nd view and then set that view ac...

ObjectDataSourceControl unable to find Type in imported namespace

I have an aspx page in a ASP.NET 2.0 application using several ObjectDataSources. They are all bound to the same class like so: <asp:ObjectDataSource ID="TitleDataSource" runat="server" OnSelecting="TitleDataSource_Selecting" SelectMethod="GetTitle" TypeName="DropDownDataSource"></asp:ObjectDataSource> This was working fine. Then I m...

Using Reflection and Collections to Illiterate a Object Rational Database

Hi All, Have C# question; I've been searching for a way to lets say dynamic created objects at runtime by iterating though them and there properties/methods. so far i've played with using Reflections and foreach to illiterate the class properties. This is to display all records in various tables on a Data Grid view. However one approac...

How do you manually databind complex object to templated control like a row in a gridview??

I am struggling with the databinding syntax here. For example I have a data structure like this - public class Course{ public string CourseName {get;set;} public string CourseCode {get;set;} public List<Instructor> InstructorsTeaching{get;set;} } public class Instructor{ public string InstructorName{get;set;} public string Instru...

If controls are always binded to data source controls in the order they are declared then

Hello, A) Question below is based on the assumption that controls are always binded to data source controls in the order they are declared? So in our example SqlDataSource1 will connect to data source prior to SqlDataSource2 and thus lstCities will be populated with values before GridView1, and reason for that being that lstcities was...

FormView ConvertEmptyStringToNull and binding

I'm using a FormView with an ObjectDataSource and binding using <%# Bind("WhateverProp") %> - and all of my nullable columns are coming back with default values of the type in them. It appears that the FormView object doesn't have a ConvertEmtpyStringToNull property like the other binding containers do. I've found articles suggesting...

What is the best way to handle ObjectDataSource exceptions?

Hello gurus, I have an ObjectDataSource in an ASPX page calling CRUD operations from a business logic class. When exceptions occur during those operations, I'd like to inform the users of the errors as well as logging them. But I want a clear separation between my business logic and presentation layer. I know that Selected, Inserted,...

How does FormView EditTemplate update values in ObjectDataSource UpdateParameters under the hood?

Hello gurus, I have a FormView bound to an ObjectDataSource. * ObjectDataSource definition (omitted portion of it for simplicity)* <asp:ObjectDataSource ID="odsHousehold" runat="server" TypeName="BLL.Households" ConflictDetection="OverwriteChanges" UpdateMethod="UpdateHousehold" > <UpdateParameters> ...

SSRS: Master-detail report with two datasources

I have two local data sources that I can push into the report. Works no problem. But how do I set up the report? One data source contains a list of employees, and info about them. The other contains a bunch of working hours for each employee. I would like to use a table for the list of employees, and then have another table for the work...

DataBind and Postback

This is a general how does DataBind work questions... I have a simple page with a GridView that is bound (in the aspx code) to an ObjectDataSource. I can look in the Select() function called by the ObjectDataSource to see that it is called on the initial load and on every post back. I have some logic that happens on post backs that wi...

How can I catch a exception form ObjectDataSource.Updata()

The exception is throwed by database caused a conflicting by FOREIGN KEY. ...

Prevent a control from databinding to an ObjectDataSource?

I have a page which expects a numeric query string value. For example: Details.aspx?rgn=1234 On this page is an <asp:repeater> which is databound to an <asp:objectdatasource>. The datasource looks something like this: <asp:ObjectDataSource ID="ObjectRegion" runat="server" SelectMethod="GetRegions" TypeName="Region"> <SelectParamete...

How to set the return value of one ObjectDataSource based on another ObjectDataSource

I have two Asp.net ListView Controls bound to two different ObjectDataScource Controls. Each ODS control references 'MethodA' and 'MethodB'. I want 'MethodA' to make one call the the database and return data for both 'MethodA' and 'MethodB'. I could always have 'MethodB' make a second call to the database, but that would not be ef...

ASP.NET: Dealing with object types as parameters when updating in ObjectDataSource

How do you guys update let's say for example a FormView with an ObjectDataSource source. The DataObjectTypeName is a class which I have already marked with a DataObject attribute. Now, I want to customize the update process and add some custom data to the parameter. What do we need to do so? Example: I have a BLL class which let's call ...

Using ObjectDataSource and DataObjectTypeName, How Do You Handle Delete Methods With Just An Id Parameter?

If I have an ObjectDataSource setup like: <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Employee" InsertMethod="Insert" UpdateMethod="Update" DeleteMethod="Select" TypeName="EmployeeDB"> </asp:ObjectDataSource> and a data/business object with methods like: public clas...

Why isn’t ObjectDataSource’s matching algorithm as flexible as…?

Hello, Even though UpdateNames stored procedure only takes one parameter named @First, we are still able to define additional parameter named Last, and the update will still be successful: <asp:SqlDataSource ... UpdateCommand="UpdateNames" UpdateCommandType="StoredProcedure"> <UpdateParameters> <asp:Pa...

I assume SqlParameter.IsNullable only makes sense when…?

1) When SqlParameter.IsNullable is set to true, received null value is converted to DBNull.Value and sent to database. Thus I would assume setting IsNullable to true only makes sense when GridView’s Parameter.ConvertEmptyStringToNull is also set to true? 2) Both GridView’s and ObjectDataSource’s parameters have a ConvertEmptyStringToNul...

ObjectDataSource Insert Method

I have an ObjectDataSource that I'm binding to a DetailsView control. I have the insert method written in a business layer (which calls down into a data layer) and everything works fine.. until i want to do something else before the insert method fires. Before going to my business layer I need access to a fileupload control. So I wi...