Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ObjectDataSource on same aspx or ascx page?

Status
Not open for further replies.

tshad

Programmer
Jul 15, 2004
386
US
Can you put the ObjectDataSources ObjectCreated and ObjectDisposing events on the code behind of the same page?

If so, how would you do it?

Say I have a page called JobsLists.ascx, at the moment I have the following for my ObjectDataSource:

Code:
<asp:ObjectDataSource 
        ID="mObjectDataSource" 
        runat="server" 
        SelectMethod="GetDataSet"
        onobjectcreated="mObjectDataSource_ObjectCreated"
        onobjectdisposing="mObjectDataSource_ObjectDisposing"
	TypeName="MySystem.DataLayer.JobsListManager"
>

This would expect the events to be on the JobsListManager.cs page.

Can I put this on the JobsList.ascx.cs page?

The namespace would be MySystem.Views.Controls, with the page being JobsList.ascx.

If so, how would I do the "TypeName" or some other settings?

Thanks,

Tom
 
If you the the control on the ascx then it will look for the events on the ascx.cs page. HOWEVER. I strongly suggest NOT using the datasource controls. You have very little control and no way of debugging them when there is a problem. You are best off creating your on DAL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top