I use ASP:ObjectDataSource
for grid data binding.
My problem is when I run this code I get error.
<asp:ObjectDataSource ID="odsListing"
runat = "server"
SelectMethod = "MethodNameOfCodeBehindClass"
TypeName = "FolderName_CodeBehindClassName" ></asp:ObjectDataSource>
Error message
The type specified in the TypeName property of
ObjectDataSource 'odsListing' could not be found.
So I move my code to codebehind site.
#region ObjectDataSource for Grid Binding
Type type = typeof(FolderName_CodeBehindClassName);
string assemblyQualifiedName = type.AssemblyQualifiedName;
odsListing.TypeName = assemblyQualifiedName;
odsListing.SelectMethod = "ListingDatabind";
#endregion
Now Everythings is ok. It is work. But I would like to know actual solution for my problem. Why it raise error?
Actually, I don't want to move my code to codebehind layer if it can write at design layer.
Every suggestion will be appreciated.