.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Programmatically changing DispForm.aspx

Posted By:      Posted Date: October 28, 2010    Points: 0   Category :SharePoint


I've got some code setup which alters the DispForm.aspx page for a list. It gets a web part manager instance, deletes all webparts (the default listview one) and inserts a custom webpart.

The code seems to work, but for some reason; the file disappears after it's changed. I can't see it any more in SharePoint designer, and the DefaultDisplayFormUrl property of the list suddenly becomes null.

What's the proper way of programmatically changing DispForm.aspx without messing up the list instance?

MCTS in Web Application Development in .NET 2.0

View Complete Post

More Related Resource Links

Programmatically Changing the Profile Provider at Runtime


Dear All

I'm using one application but have multiple providers in my web.config for memberships, roles and profiles to allow my application to be used by different groups of users who need to connect to different databases.

This means I'm having to change the membership, role and profile providers on-the-fly in my code-behind files. So far I've taken care of the membership and roles a bit like this:

Dim RolePV As RoleProvider = Roles.Providers(GetSettingFromFile("Provider"))

However, I'm having trouble finding out how to do the same sort of thing for Profiles. I've looked at ProfileProvider and ProfileManager but I can't work it out how to access my the profile property that I've created in my web.config file called "ScreenSize". Normally you would just write Profile.ScreenSize to read or write to the property.

Please can you help me to understand how I access the profile property called ScreenSize by dynamically setting the profile provider first?

I'd be very grateful for any help or advice.

Many thanks



Changing aspx page causes session data to be lost...


Strange but true. Any ideas what might be causing this?


Way of showing ID on the DispForm.aspx page without programming?

Is there a way of showing the ID system field on the DispForm.aspx page without programming.
I don't want to use a dataview, as new fields being added in the future won't appear automatically anymore this way on the DispForm.aspx page. 

I found somewhere that I could use a calculated field, with as formula =ID (so, in fact just copying the value of the ID field in the calculated field), which is one option.

Are there other options/solutions known?
Patrik | My Blog

Get Content type Id in dispform.aspx

I have added a data view web part to a DispForm.aspx of a particular list which displays the data from the child list associated to that particular list item in the parent list. In the Child data view web part I show the list of child items and a hyperlink to create a new child item.  But, the child list has 11 content types and i need to redirect to appropriate newform.aspx,how do i get the contenttypeid so that i can append to the url and redirectPlease remember to mark your question as "answered" if it solves your problem. My SharePoint Blog http://dhireny.blogspot.com

Copy of dispForm.aspx and lookup column

Hello, we have created in SPD 2010 a new Dispform. This new dispformuser.aspx is the new default form for viewing list entries. We want to hide some elements with jquery. We are using some lookup columns in our list. When we open an entry in the new form, the lookup-columns looks like <a href="http://s-sharepoint-02.kkrn.local/_layouts/listform.aspx?PageType=4&ListId={1D8EE013-E164-482F-861E-9CACB2EBF6B5}&ID=1&RootFolder=*">Marien-Hospital</a> The form is not customized at the moment, it is only a copy at the moment. Any other colums are ok. Editform and newform seems to be ok, also the lookup columns. Maybe somebody can help us with this behaviour.  thank you Regards Marc

Custom Email Alert template creating links to DispForm.aspx

I have a requirement to customise the alert template for a standard blog post list. To do this I: 1. Created a copy of alertstemplate.xml 2. Copied the genericList alert template node and customised 3. Registered the new template file against the site collection, iisreset and finally assigned the new Alert template to the list, when alerts are created the custom template is emailed. The problem now arises that the 'View <Post Title>' in the toolbar section now creates a hyperlink to http..../Lists/Posts/Dispform.aspx?ID=xx rather than post.aspx. I have checked using sharepoint designer that the list supporting files has the correct display item form of Lists/Posts/Post.aspx. Additionally if I reset the alert template for the list back to use the Generic list template the same problem still occurs so this leads me to believe it is not the customisations that are the problem. Code used to assign the alert template to the Posts list: var ats = new SPAlertTemplateCollection((SPWebService) site.WebApplication.Parent); var newTemplate = ats[alertName]; if (newTemplate == null) { // We did not find the specified Template. throw new Exception("Failed to find template SPAlertTemplateType.NewsPost in the template collection."); } list.AlertTemplate = newTemplate; list.Update(); Any assistance will be most welcome, thanks in advance. Alan

About Dispform.aspx

Hi,I designed one data submission form which stores the data in List.if you search something related to listitems the output will display in dispform.aspx.but as per my requirement they(customer) dont like look and feel of dispform.aspx.so i redirected to my own customized page writing some code(javascript page redirect code ) in dispform.aspx.In my customized page i am showing results(list items).if you search something related to listitem first it will show in dispform.aspx(for a 1sec) then after showing my customized page.So how can i solve this one.(customer want some flas on result page i.e customized page)any suggetions or any another way to change or customized  of dispform.aspx.please help me out.Thankyou for your valuable suggetions.Thanks

Custom DispForm.aspx and Search Results

I am a developer, but am proofing somethig in SPD 2010.  I am trying to create custom New/Edit/Disp/List forms for some OOB SharePoint 2010 lists (think Announcements, etc).  I am going this route because we are leveraging a mix of OOB functionality and custom functionality.  We want to avoid users "accidentally" navigating to the OOB New/Edit/Disp/List forms and have only our custom forms displayed.  This includes things like creating new items in calendar view and links from search results. So far, I have used SPD to create a new, custom, DispForm.aspx named "DispFormCustom.aspx".  I just made minor modifications to it so far - like changing background color to red.  Otherwise the new "DispFormCustom.aspx" is exactly what SPD gives you when you say you want to create a new Display Form.  I have selected that the custom form be the "Default" display form for the list. When I go into the list, and select "View Item", I get my custom form. When I do a search (using OOB search), the search result takes me to the original "DispForm.aspx" and not my custom form (eventhough I have specified it to be the default).  I have cleared the search index and done a Full crawl and the same behavior. I did navigate to the Content Type edit screen in SPD, in the "Forms" section, modif

How to programmatically POST data to an aspx page?


Hi everyone,

I'm trying to POST data to an aspx page.

I've got a button click event (btnSend_Click) within which I want to programmatically POST data ("key1=value1", "key2=value2") to another aspx page ("ReceivingPage.aspx") on my site.  It would be very easy to do if it were a GET, cos I'd just append the data key/values to a query string of a HyperLink control. But How do I do this as a POST? 

Thanks for the help. 

Hide the empty rows on dispform.aspx using javascript


Guys, can I hide the empty rows on display form using javascript?

If you know anything, Help me.


Retreive Customer field value in dispform.aspx


Hi All,

I have customized newform.aspx in sharepoint to use a new Customer field (which I added as dropdownlist connect to my own customer table). Everything works Ok. I can see customers in create service request.

But now when I see existing service request from the list using dispform.aspx  it doesnt show the customer value. How can I do this? Thanks.


How Do I Fix Broken Link to DispForm.aspx?


Hi All,

I've done a bit of renaming of form pages under one of SharePoint lists, and have no discovered that instead of linking to DispForm.aspx, the picture library in question, now just links to the home page. My first reaction was to right-click the list in SharePoint Designer, and go "Properties". I then when to the "Supporting Files" tab, but it only allows you to specify the "New Document" and "Edit Document" forms. It doesn't have anywhere to set the "Display Form" page.

Can anyone tell me how I can link my picture library back to DispForm.aspx?


Programmatically changing the 'Activities I am following' under Newsfeed Settings

Hi, is it possible to programatically select/deselect activities I am following on the news feed preferences page under MySites? I want to be able switch on/off notifications for both custom events and those provided by Sharepoint 2010 out-of-the-box.

Sharing custom DispForm.aspx across sites

We have a need to customize the default dispform.aspx for displaying announcement content type.  I have created a test site and created a modified dispform to display the announcements like i wanted.  I would now like to copy this modified dispform.aspx to another site and display the announcements for that site using the customized dispform.aspx.  Apparantly I cannot simply copy the modified dispform.aspx to the site.  Also, what would I need to do to change the default list form dispform.aspx for the entire site collection.  Any assistance would be greatly appreciated.

Crystal Reports Report on DispForm.aspx


Hi Guys,

i've a question regarding Crystal Reports and MOSS2007 Standard. At the moment its my task to redesign the DispForm.aspx of a sharepoint list item. The DispForm.aspx should contain a Crystal Reports report.

I found serveral blog posts and tutorials in the internet, but they don't work for me. The problem is that the report don't appear on the DispForm.aspx everything else work fine.

I wrote this piece of Code for the DispForm.aspx:
<%@ Register Assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<%@ Register Assembly="CrystalDecisions.CrystalReports.Engine, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<%@ Register Assembly="CrystalDecisions.Shared, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"

Order of form items in DispForm.aspx and NewForm.aspx

I created a new list (it is not a content type).  I went into the List Setting and set the column ordering.  However, on my Form pages (DispForm.aspx, EditForm.asp, NewForm.aspx) the form elements are NOT following this order.  Can someone tell me what I have done wrong please?
There are no mistakes; every result tells you something of value about what your are trying to accomplish.

StatusNote: Changing the default "What's Happening?" message to something else in the Person.aspx p


Could somebody provide me a way to change the default message "What's Happening?" in a user's status (My Profile page) to something else?

Any help would be appreciated.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend