.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

How to edit a view programmatically

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

As the title says, i need a way to programmatically edit an existing view of a list in sharepoint 2010. I have found a lot of examples about creating a new view:

        SPList documents = web.Lists["Documents"]; 
        StringCollection fields = new StringCollection(); 
        fields.Add("File Size"); 
        fields.Add("Modified By"); 
        var query = new XElement("Where", 
                new XElement("Eq", 
                  new XElement("FieldRef", new XAttribute("Name", 

View Complete Post

More Related Resource Links

How to properly configure permissions so users can view, add, edit, and delete list items, but not w

I am trying to figure out how to properly setup security so that it can be configured at the top-level, and then inherited all the way through. Here is what I would like to do: Each user can view, add, edit, and delete list items - but, users cannot modify or delete web part pages. The only way I know how to do this is set Contribute from the top-down, and then go into each Site Pages library and set Read access. The problem is that I have 100 sites, and I was hoping there was a way I could set security at the top, and inherit downward. Rather than having to go into all 100 Site Pages library and set Read access. Is there a way to do this? Thanks in advance.

Programmatically adding Calendar web part with summary view or custom view?

Within my feature I am adding a calendar web part to page.  I would like to specify the summary view (not the full graphic calendar view).  Is this possible? Is it possible to create a custom view and set the listviewwebpart to this custom view through code?   thx -davedave

Add subform to New, Edit, and View forms

I have two lists with related information: Projects and Tasks. I would like to edit the NewForm, EditForm, and ViewForm for the Projects list so that users can add, change, and view related tasks in a datasheet subform. I know how to do this in Access forms, but it seems there is no easy way to accomplish something similar using SharePoint lists and the SharePoint Designer. I have seen other posts, listed below. http://social.technet.microsoft.com/Forums/en/onlineservicessharepoint/thread/f803ee36-8853-4a73-8d10-1fc687a37781 This is not very helpful, for users would have to be jumping from one list to another and manually creating the relationships between projects and tasks. That is cumbersome. http://geekswithblogs.net/SoYouKnow/archive/2008/12/24/creating-a-sharepoint-list-parent--child-relationship---out.aspx This relates to what I need, but I guess there is something wrong with the steps, as I cannot get the parent form to set parameters for the subform. Has anybody been able to accomplish this?

Edit in Datasheet view does not work on one SharePoint 2007 farm, works on another.

The ability to edit in datasheet view on one of our environments no longer works.  I've tried different client machines on different builds and regardless of the install every library, list, etc. when attempting to edit in datasheet view shows as read only.  Our other environments those systems work as intended with those same clients. I've searched all over and haven't found anything that helped.  Any ideas?

Creating calendar view from tasks list programmatically

Hi All, I have a Tasks list of type "107" and I am trying to create a Calendar view for the tasks list. The way I created the calendar view is as follows: SPView calView = l.Views.Add("Calendar", l.GetView(l.DefaultView.ID).ViewFields.ToStringCollection(), string.Empty, (uint)100, true, false, SPViewCollection.SPViewType.Calendar, false);<br/><br/> I would like to specify the Time interval, Calendar columns, Default scope for this view. Can anyone point me to documentation for creating a calendar view from tasks list? Do I need to specify that in the viewquery?Thanks.

Edit in Datasheet View on List is not working

I have a list with simple column types like single line of text, Number, Hyperlink,  Picture, choice. When i edit the list in datasheet-view, below error is getting displayed. An unexpected error has occured. Changes to your data cannot be saved. For this error, you can retry or discard your changes. This error is occuring on edit certain rows/columns only. The view is having a simple filter condition. Could anyone check and suggest a solution/workaround for this ? Thanks in advance.      

Auto-fill Title and other fields from a data View edit menu

How do I Auto-fill Title and other fields in a list from a data View edit menu. The Title and other current data should transfer from the data view row being edit. Can anyone point me into the right direction how to accomplish this? Thanks. Mike  

Can edit, but can't view Word docs in web apps.


I'm having a very odd problem with the Word web app.  I can view some word docs on my sharepoint site, but when I try and view others I get the "... Unexpected Error" problem with others.  The ones where I get the error I can click the drop down and select "edit in web browser" and it works fine!  Very odd, these docs are in the same doc lib.  So, how can I edit, but not view?  Very strange and frustrating.....  Any one else see this before?

Also, I looked in all the logs and I don't see any extra infromation.  :(

Chad Gronbach

OOTB Approval Workflow SharePoint 2010 - Blank "Requested By" field appears in Task Item edit/view f



I am having a simple OOTB  approval worflow associated to the simple document library. Task is created when an document is uploaded to the library.  When I click the task item in task list, I see a blank field "Requested By"  right below the "Status" column and I am unable to understand from where this field is coming and how to populate this field. Any help would be great...

Help with programmatically set Edit, Update in Gridview


 I'm at the front end of allowing the user to update their data that requires nested gridviews.

I thought I had it set up correctly, but; once I have the grivdiew in Edit mode, when I move the cursor to the first row's textbox, the routine switched out of Edit mode (without a clicking on the Update). I would like to update the data on the screen before the program decides to update the db.

What's causing this?

Here's my aspx page as follows:

<%@ Page Language="VB" AutoEventWireup="false" EnableEventValidation="false" CodeFile="RONs_UPDATING.aspx.vb" Inherits="RONs_UPDATING" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
    <div id="div_units" runat="server" style="font-size: medium">
        <asp:GridView ID="gv_x_Units" runat="server" AutoGenerateColumns="False" Style="z-index: 100; left: 110px; position: absolute; top: 10p

Excel "View in browser" or "Edit in browser": Unexcpected Exception


Hey everybody

We are using Sharepoint 2010 (Enterprise), Office web apps is installed.

Powerpoint & Word web apps work (view or edit in browser).
When we click on an excel 2003 file we recieve the open in excel dialog (read-only / edit).

Wen we click on an excel 2007 file we get an unexpected exception.

I used the ULS viewer and the correlation id to retrieve the stack trace below:
System.NullReferenceException: Object reference not set to an instance of an object.  
 at Microsoft.Office.Excel.WebUI.XlViewer.OnInit(EventArgs e)   
 at System.Web.UI.Control.InitRecursive(Control namingContainer)   
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Exception follows on the heels of:
Name=Request (GET:http://bekrbsv313:80/sites/medical/_layouts/xlviewer.aspx?id=/sites/medical/Scrum/Sprint.xlsx&Source=http%3A%2F%2Fbekrbsv313%2Fsites%2Fmedical%2FScrum%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1)

does anybody have a clue?

I'm getting desperate :-)

Enabling Edit , delete and insert in Data view with linked sources


Hello ....


I create a data view in sharepoint designer 2007 that has linked sources (Join between two lists) ....


How can I enable edit, delete and insert links in this data view  ????.... taking in consideration that options available in data view properties appear in gray ...



Grid View edit



I have a grid view that does add, edit update and delete.  ( I draged the grid to the aspx page ) it is working. I would like to have the following : once I lick on edit, I open a form inside the grid view to edit the fields. How can I do that




Sharepoint Foundation - Create and deploy custom edit/view forms for external lists


Firstly, we are using sharepoint foundation so Infopath forms are not an option for us.

We have a Visual Studio sharepoint project which deploys a complete sharepoint site. The site contains a number of external lists and we want to be able to create customised view/edit forms for these lists and add them to our Visual Studio project so they can be deployed as part of the new site. The idea is that we can deploy the solution to a fresh site with a default set of forms which can then be customised for different implementations of the site.

Here's the steps we have been using to try and do this:

1. Deploy the base project (BDC) to the sharepoint site

2. Create external lists based on the BDC content types

3. Use Sharepoint Designer to create new edit/view forms for the lists and set these as the default forms for the list

3. Save the site as a template

4. Import the template into a new Visual Studio project and select the lists we require. This gives us a List Definition, a pages module (with element file), an elements file and a schema file (both for the List Instance).

5. We then add the contents of the imported project to our main solution as follows:

  • Create a new List Definition (including List Instance)
  • Copy the contents of the imported Elements.xml to the Elements file for our List Instance.

Unable to edit in Datasheet View


Myself and several other users try to edit cells in a datasheet view and often get the error:  "Edit control creation has failed. You cannot edit cells".  This is an intermittent problem. We are all running Windows7 and Office 2007. Any ideas what causes this?

Fine-grained User Permissions, create and view with restricted edit rights


I'm running a Sharepoint 2007 installation which is slowly being rolled out through the organisation. We have a group of calendars which are shared between 14 executive PAs. I've been asked to lock down the permissions so that whilst any of the users can add items, only the user who created the item can subsequently edit this. I thought I could handle this by creating a new permission level with create and view rights only, which does what it should, however the user can now no longer edit their own appointments either.

Is there a way that I can give the item creator specific permissions on their item by default?

How to create a custom content type with own custom view ,add, edit and delete form in sharepoint fo


How to create a custom content type with own custom view ,add, edit and delete form in sharepoint foundation server 2010 using visual studio 2010?

I donot want to use default form "form.aspx".

we can use my custom form in place of "form.aspx"?

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