Hot answers tagged

6

GridViews, as linked to by Ziga, are a standard .NET control. If you're asking about that, then you'd probably be better off asking at Stackoverflow; this is the forum about SharePoint technologies. However, SharePoint does have it's own SPGridView. It's much like the standard .NET one, but doesn't have some of the features of the .NET one (such as auto ...


5

Here are some links about how to implement paging and filtering in SPGridView Code Project reversealchemy


4

I have put your code in the page load event and it resolves the issue. btnExport.UseSubmitBehavior = false; btnExport.OnClientClick = "_spFormOnSubmitCalled = false; _spSuppressFormOnSubmitWrapper=true;";


3

This error exception is thrown mostly when you try accessing an item at an index that isn't present. The best way to resolve the issue is to debug and check the length of the array or the data table indexes and then see whether you are deleting the correct index or not. As per described in the comments below you would need to mention the column index that ...


2

This is the code from my project <asp:DataList ID="dlPaging_Top" runat="server" RepeatDirection="Horizontal" OnItemCommand="dlPaging_ItemCommand" OnItemDataBound="dlPaging_ItemDataBound"> <ItemTemplate> <asp:LinkButton ID="lnkbtnPaging" runat="server" ...


2

Here is an example for you and it is the combo of REST and AngularJS. Let me know if you have any questions.


2

Try to delete item operation explicitly then it will work string itemId; protected void grdcrud_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { try { itemId = grdcrud.DataKeys[e.RowIndex].Value.ToString(); SPSecurity.RunWithElevatedPrivileges(delegate() { ...


2

Try using SPListItemCollection.GetDataTable like this: var dt = list.GetItems(oQuery).GetDataTable(); gridView.DataSource = dt; When you just use list.GetItems(oQuery) as the DataSource what the GridView gets is a SPListItemCollection which it doesn't understand, but it's an IEnumerable which it understands. So now the GridView can enumerate the ...


2

You can use built-in server controls in a SharePoint-Hosted app. You just can't use any code-behind. The markup for the various data source and UI controls remains the same. <SharePoint:SPDataSource ID="SPDataSource1" runat="server" DataSourceMode="List" SelectCommand="<Query></Query>" > <SelectParameters> ...


2

Please update the code of bindToGrid() as below: protected void bindToGrid() { SPWeb web = SPContext.Current.Web; //SPList list = web.Lists["Employee"]; SPView spView = web.Lists["Employee"].Views[<YOURVIEWNAME>]; SPQuery spQuery = new SPQuery(spView); //SPListItemCollection items = list.Items; SPListItemCollection items = ...


2

You can create a view using SPView class and in query give Author=[Me] and set this view as default view About the default "All Items" view, set its permission to be viewable to only Administrators or Group with Full Control... See How to create SPView Programmatically and Programmtically create SPView Let me know if you need more help!


2

Glolita, Use SPGridView instead of ASP:GridView... Here is a nice article: How to use the SPGridView filter together with a SPDataSource I also noticed in every example in CAML before <Query> they are using <View>, but I don't know if this is really the problem... can you please try that as well Also, SPTypes.DataSourceMode="List" Hope ...


2

<asp:TemplateField HeaderText="Date Range"> <ItemTemplate> <%# string.Format("{0:dd MMM yyyy}", Eval("From_Date")).Equals(string.Format("{0:dd MMM yyyy}" ,Eval("To_Date")))? string.Format("{0:dd MMM yyyy}", Eval("From_Date")) : string.Format("{0:dd MMM yyyy} {1:dd MMM yyyy}", Eval("From_Date") ,Eval("To_Date"))%> ...


2

Alternatively, you could use SPFieldLookupValue (for a single lookup) and SPFieldLookupValueCollection (for a multi-lookup) to parse the field values using SharePoint's built-in methods for processing them. Here is a revised version of your function for single lookups: protected string RemoveCharacters(string fieldValue) { SPFieldLookupValue value = ...


2

Firstly, to deal with the display of the results. You will most likely be using a CoreResultsWebPart to display the output of the search; this has an Xsl property which can be used to style the results in the style desired. Using this you can make the results appear as a GridView. However, there is no builtin control that will allow you to edit items ...


2

I don't know if this is what you are looking for, but it's a start - http://msdn.microsoft.com/en-us/library/ms752213.aspx


2

SPGridView has much less functionality than GridView, I found it frustrating to work with in SharePoint 2007 in terms of presentation. This is a great intro and here is help on filtering


2

The problem is that you are creating the CommandField button in a postback event: SumbitSearch_Click. Take a look at Wictor's wonderful graphic. Instead, you should be overriding the CreateChildControls function and creating most of your controls there. You'll notice, however, that on a postback the CreateChildControls will be called before your ...


2

The point is that you're changing only title of the field, while the column internal name remains unchanged. This behavour is intended, overwise your programmatic functionality may broke down if user accidentaly changes the field title. Also, fields titles could be localized. So, if you need to change field internal name, then probably the easiest way to do ...


2

Assuming you're working in server side code: Take a look a the Attachments property of the SPListItem, it returns an SPAttachmentCollection, from there itterate the SPFiles and use the Url property to get the site relative path and you should be sorted from there. Some times the docs on MSDN are actually quite helpful :)


1

You can set the DataFormatString property on your date BoundField: boundField.DataFormatString = "{0:d}"; A similar question was asked on Stackoverflow.


1

if you are using custom code, why do you actually need to save the list items before the order is created? Cant you just store them locally in the code until the submission is completed? If you cannot, have your webpart generates its own GUID that it can use to store all of the order items in a temporary list before they are ready to be added to the ...


1

Have you tried? grid.Columns[i].ItemStyle.Width = 200


1

I had the same issue on my last project. The main problem is sharepoint catches form submits and downloads so you cannot double click a button. So I added this to the page <script type="text/javascript"> _spOriginalFormAction=document.forms[0].action; _spSurppressFormOnSubmitWrapper = true; </script> I Think that fixed that issue, but ...


1

You would have changed the display name (Title property), not the internal name (InternalName property). Fields are usually referenced by their internal names when using the API in SharePoint, although there are quite a few places where both the display name and title can be used. You must use the original name of the column, or recreate the field with the ...


1

One thing that comes into my mind is to create a custom list schema which includes the appropriate CAML to render the video file as HTML5 video tag. This would of course require that you either use a modern Web browser (e.g. IE9 or the latest version of Firefox/Chrome/Safari/Opera) or employ a technique described at the "video for everbody" page ...


1

Use the ViewFields property on your SPQuery to return only the fields you need, add in: query.ViewFields = string.Concat( "<FieldRef Name='Title' />", "<FieldRef Name='Mobile' />", "<FieldRef Name='EmailId' />"); query.ViewFieldsOnly = true; // ...


1

If I understand correctly the task is to audit the users activity. You can use the SharePoint 2010 auditing feature and then publish the report to a library. The SharePoint Server auditing capabilities allow you to track all activities that occur within the environment. The site collection administrator has the ability to set auditing requirements within ...



Only top voted, non community-wiki answers of a minimum length are eligible