Quantcast
Channel: My name is Justin Kohnen, and I’m a Geek.
Viewing all articles
Browse latest Browse all 28

Using an ObjectDataSource in Sharepoint

$
0
0

A Co-worker was trying to use an ObjectDataSource within a UserControl within SharePoint.

After a bit of research. We learned one must use the fully qualified name of the class and assembly when defining the TypeName.

So we did it, but in the code behind.

ASCX Snippet

   1:<asp:ObjectDataSourceID="odsProfit"runat="server"
   2:SelectMethod="GetData">
   3:<SelectParameters>
   4:<asp:ParameterName="DataID"Type="Int32"/>
   5:</SelectParameters>
   6:</asp:ObjectDataSource>

ASCX.cs Snippet

   1:protectedvoid Page_Init(object sender, EventArgs e)
   2: {
   3:     odsProfit.TypeName = new ProfitManager()
   4:                                 .GetType()
   5:                                 .AssemblyQualifiedName;
   6: }

I just thought I would share.

Cheers.


Viewing all articles
Browse latest Browse all 28

Trending Articles