Tag Info

Hot answers tagged

2

Existing code that utilizes object model and runs within IIS will continue to work without recompilation (if compiled for AnyCPU or 64-bit). As when upgrading from SPS 2003 to SharePoint 2007 the upgrade process inserts assembly binding redirects from old assemblies to new assemblies (here 12.0.0.0 to 14.0.0.0) making the code automatically redirect to the ...


2

Please check this post - http://www.fivenumber.com/export-spgridview-to-excel-spreadsheet-in-sharepoint-2007/


2

Yes, it is possible but it is kind of a hack. Step 1: Make your filter values pretty For this, you'll need to create a class inheriting from SPGridView and override the GetCallbackResult function: public class SPFilterGridView : SPGridView { protected override string GetCallbackResult() { string result = base.GetCallbackResult(); // do ...


2

I think the problem is that you on post backs do not create the ObjectDataSource object and configure the SPGridView object. Refactor your code to do this in the CreateChildControls() method that you must override from the base class. Also call grid.DataBind() in the PreRender phase and not in the Render phase. Here is another useful article on the ...


2

These 3 members are used to handle EmptyData in the SPGridView. EmptyDataRowStyle EmptyDataTemplate EmptyDataText Also check out this link for more info Update 1: If you just want to show the headers even though there are no data, use the ShowHeaderWhenEmpty property. Update 2: Check the list of properties and members for the SPGridView here.


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!


1

Your class SimpleSPGrid does not inherit from anything, so I presume it inherits from Object. CreateChildControls() is a method of the Control class. Since the Object class does not have a CreateChildControls() method, SimpleSPGrid can't override it. Solution: Change the line Class SimpleSPGrid to Class SimpleSPGrid : Control Another option, if you ...


1

As Arsalan mentioned you can create a SPView which does filter by Me. Here is the CAML query for doing that: query.Query = "<Where><Eq><FieldRef Name='Author' /><Value Type='Integer'><UserID Type='Integer' /></Value></Eq></Where>"; Here I have written a blog post which shows how to create a an SPView ...


1

ObjectDatasource takes the TypeName of your data source, not the Qualified name. You need to modify this Type t = myDataTable.GetType(); ds.TypeName = t.AssemblyQualifiedName; so you set the TypeName property to the type name for example "My.ObjectDataSource.NorthwindData" instead of "My.ObjectDataSource.NorthwindData, mscorlib, Version=2.0.0.0, ...


1

You can't. Datasheet mode is an ActiveX control. It is completely separate from the SPGridView. AFAIK, you can't use the datasheet activex control in your customizations and you can't customize the control itself.


1

You will need to override the OnPreRender method to escape the single quotes: protected override void OnPreRender(EventArgs e) { if (!string.IsNullOrEmpty(_gridDS.FilterExpression)) { _gridDS.FilterExpression = string.Format( _grid.FilteredDataSourcePropertyFormat, _grid.FilterFieldValue.Replace("'", "''"), ...


1

Use the build-in webdeveloper tool in the browser (F12) and inspect the element. I'm pretty sure it's just border around the contextmenu div. Add the below to your CSS file and brand it. Beware that this will change it for all contextmenus on your site using your CSS file, so you might want to narrow it down to your custom list. Over all: .s4-ctx{ } ...


1

Ok. I was being silly. I'm using a visual webpart, but the blogs I've been reading from were for 2007 webparts. In my OnInit, I was setting spGrid = new SPGridView(); dataSource = new SPDataSource(); which of course reset all the settings of the SPGridView and SPDataSource I set in the ascx page. Therefore AutoGenerateColumns were set back to true, ...


1

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


1

Dont forget to set the 'onSorting' = 'your_event_handler', and give each sortable column a 'sortExpression'. I also advise declaring the DataTable as a global variable so you can cache the data for sorting during the event. *Beware the e.SortDirection stays 'Ascending' unless you deal with it, so instead I use a work around and track the current column name ...


1

Tried any of these examples (sorting must be "implemented" when using a DataSource other than the a List/View or result of SPQuery)? http://www.threewill.com/2010/08/the-great-and-powerful-spgridview/ http://sharethefrustration.blogspot.com/2010/02/spgridview-webpart-with-multiple-filter.html


1

I find :) e.Row.Height = new Unit(25); if (grid.Columns.Count > 1) for (int i = 1; i < grid.Columns.Count; i++) e.Row.Cells[i].Wrap = false;


1

There is a property called DataKeys http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.datakeys.aspx


1

Maybe It's not what you are looking for, I'm just sharing. I used this styles in all of my project whenever I utilize SPGridView to display data. Style="border-bottom-style: none; border-right-style: none; width: 100%; border-collapse: collapse; border-top-style: none; border-left-style: none;" CssClass="ms-listviewtable" ...


1

Create a descendant of SPGridView and add a method to clear the filter. public class MySPGridView : SPGridView { public void ClearFilter() { base.RaisePostBackEvent("__SPGridView__;__Filter__;__ClearFilter__"); } }


1

You would need for sure to built it yourself by attempting to attach your own coding to it. This articles explains the mechanism triggering the filter behaviour http://ketulpatel.wordpress.com/2008/05/30/custom-filters-in-spgridview/, but as of yet (except probably when customizing the XSLTViewWebPart - which does not apply here) I haven't seen a hookup as ...


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

accordingly to error with CAMOpt - make sure that js file that defines the function is referenced in popup, it seems to be - MENU.debug.js or MENU.js to build the menu. Also the difference in visible/hidden is in filter option that is displayed when you mouse over the column.


1

Thanks for the comments. I didn't ry them but they seem very helpful. I solved it with an Templatefield too but created a class and used a Linkbutton. Here's the code: public class TemplatedUserControl : ITemplate { private string loginName; private string displayName; public TemplatedUserControl(string loginName, string displayName) ...


1

This can be easily done with either: XsltListViewWebParts (superceded the DataViewWebPart in SharePoint 2007) in SharePoint Designer or ContentQueryWebParts with a custom ItemStyle.xsl Google for both, lots of examples out there. No need whatsoever for managed code / visual web parts.


1

Well, ultimately you can do anything you could do in ASP.NET - so there are a huge number of options. Likely candidates include: List View Web Part (Shows data from a table. Pro: easy. Con: limited in control of display) Data View Web Part (Shows data from a variety of sources. Pro: easy, more control. Con: harder to deploy, in my experience.) The ...


1

One option would be to create a control redirect using the .browser file. This way you can replace any SPGridView with your own class. THe problem there is of course that this will be an app wide change... The redirect would allow you to use your own custom (derived from SPGridview) control, in which you could change the default behavior of the control.


1

Are you able to recompile the code and reference the SP2010 assemblies? I think that'd be your recommended route.


1

This may be a case where your event handler for the link button click event is throwing an exception before it gets to the point where it registers your script for popping up the modal dialog (It looks like the code is wrapped in a try/catch) Have you stepped through your code using the visual studio debugger to try to work out what is happening?



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