D
djionel82
I have a user control which needs to display some data.
Where should I place the the objectdatasource that holds the data?
I have threee options:
1. I define the object data source in the page where the control is
used and in the ascx page of the user control, I refer the
objectdatasource. The drawback is that I have to define the
objectdatasource with the same ID as the user control expects.
2. I can overcome the drawback from 1. by exposing a propertz that can
set the ID of the objectdatasource. But what i still don't like about
this solution is that I have the usercontrol and the objectdatasources
defined in two separated pages.
3. I can define the object data source inside the user control and I
can expose it through a public property. this way i have access to the
objectdatasource of the user control and I don't have to clutter may
page with object datasource needed only for the user control.
which is the best practice?
Thanx,
Ionel
Where should I place the the objectdatasource that holds the data?
I have threee options:
1. I define the object data source in the page where the control is
used and in the ascx page of the user control, I refer the
objectdatasource. The drawback is that I have to define the
objectdatasource with the same ID as the user control expects.
2. I can overcome the drawback from 1. by exposing a propertz that can
set the ID of the objectdatasource. But what i still don't like about
this solution is that I have the usercontrol and the objectdatasources
defined in two separated pages.
3. I can define the object data source inside the user control and I
can expose it through a public property. this way i have access to the
objectdatasource of the user control and I don't have to clutter may
page with object datasource needed only for the user control.
which is the best practice?
Thanx,
Ionel