Create Data View Web Part Programmatically

Is there any example code on how to create a data view web part programmatically in C#?. I tried using the ASP.NET markup as a guide as to what properties need to be set, but I can't get it to work, it just gives the good old Web Part Maintenance Page.

Todd Wilder

[368 byte] By [Wildert] at [2008-1-8]
# 1

Hi Todd --

Yes, you can create dataview webpart programmatically, and it is very useful. One thing I faced was that I was not able to update the datasource after the dataview was created. I had to delete and recreate the webpart.

This blog has sample code.

http://www.jyhuh.com/blog/archive/2007/05/23/Creating_DataView_programmatically_using_DataFormWebPart.aspx

Hope this helps

Shaji.

ShajiV at 2007-10-2 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Development and Programming...

SharePoint Products and Technologies

Site Classified