Hi,
The Object Datasource control used for the gridview needs a TypeName for the control to get the value from the backend.
When we have a seperate project for ASPX and ASPX.CS files, The type name can be given as the Project name of the ASPX.CS Class library.
But when we create a website or webapplication, The ASPX and ASPX.CS will be in the same project.
That time, the TYPENAME will not accept the current project name.
For that we can assign the TypeName value in the codebehind as follows
-----------------------------------------------------------------------------------------------------------------
string typeName = this.GetType().AssemblyQualifiedName;
objectDSAccountList.TypeName = typeName;
-----------------------------------------------------------------------------------------------------------------
By adding the above code in the code behind.
We can add an object datasource to a gridview or a repeater to use the paging concept for getting data.
By using this Object Datasource. We can take only a limited amount of records to be taken from the database w.r.t page size.
To use Object Datasource, See my blog posted on June 2009 for further reference.
Thank YOu
Yours
Kannan.K.Mangudi
Hi Kannan,
ReplyDeleteYour post seems useful. but when I tried to implement this I could not find any "AssemblyQualifiedName" properties. Is this a only C# property??? cause I'm using VB .net
Thanks
Black
Hi Kannan,
ReplyDeleteIt's me, Black, again. I've found the AssemblyQualifiedName property (I was using "this" for vb instead of "Me" :)
Thanks for your post. It helped :)
Black
Hi,
ReplyDeleteI have written my select,insert,update,delete methods in the code behind of my aspx page. I would like to give the same as the TypeName as it will be easy to update the UI if any of the above operations fail.
As suggested, I tried setting the TypeName as this.GetType().AssemblyQualifiedName in the code behind. With this, my grid is displaying data properly, but I am not able to edit/insert data to the grid.
I get error that TypeName specified could not be found. Please help me on this.
Thank you. Just what I needed!
ReplyDeletePerfect...
ReplyDelete