views:

75

answers:

1

What determines if an object is available in the Data Configuration Wizard? I have the following class in my BLL and I want to be able to bind controls to the data table I turned into a property but the only thing that shows up in the list of available data sources is the class name.

public class AoiNameBLL : SeedSizerDs
{
    private aoi_nameTableAdapter _aoiAdapter = null;

    protected aoi_nameTableAdapter Adapter
    {
        get
        {
            if (_aoiAdapter == null)
                _aoiAdapter = new aoi_nameTableAdapter();

            return _aoiAdapter;
        }
    }

    private aoi_nameDataTable _aoiNameDt = null;
    public aoi_nameDataTable AoiNameDt
    {
        get
        {
            if (_aoiNameDt == null)
                _aoiNameDt = GetAoiName();

            return _aoiNameDt;
        }
    }

    /// <summary>
    /// Get all records from AoiName table
    /// </summary>
    /// <returns>DataTable of all records</returns>
    public aoi_nameDataTable GetAoiName()
    {
        return Adapter.GetAoiName();
    }
}

Any push in the right direction would be great.

Thanks.

+1  A: 

Hey,

Are you referring to the ObjectDataSource? You specify the type of class to bind to in the wizard, then specify the methods for selecting, inserting, in the future screens of the wizard, or all of this can be specified in the properties window. Also, sometimes components don't show up if the project hasn't been built.

If that's not what you were referring to, please let me know.

Brian
I rebuilt the solution and it the DataTable property showed up. Now the other question I have, is this the correct way to use the ObjectDataSource with the property I have made or is there another way I should be using this?
Nathan
ObjectDataSource works by executing a method (didn't know properties worked too :-;) and the result that's returned from that member is passed to the underlying control. So that is a valid yes; I personally use methods, but whatever way that's easy to use I would do.Whether you set it up in the wizard, or using the properties window, both are correct and valid ways.
Brian
How do you get the methods to appear in the ObjectDataSoure Window? All I can get to appear are the class names or the properties.
Nathan
For me methods have appeared... maybe not, I cannot remember. You can always type in the name of the method in the properties window, for the SelectMethodName, InsertMethodName, etc. Then, you can enter the parameter manually. You may, after you type in the method name, then go back to the wizard, and it may recognize the method then (I've done that for types; it doesn't recognize the type, so you type its name into the TypeName window, go back to the wizard, and then it's there). So methods should be supported, if you can't get them to appear, I'm unsure why...
Brian
Oh I think we are talking about two different things. I am referencing the ObjectDataSource you can add through the DataSources window and I think you are referencing the actual ObjectDataSource Control.
Nathan
Oh, OK, my apologies :-; Though I guess I'm confused because if it's the web ObjectDataSource control, it can use methods (as I've used methods)... interesting...
Brian