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

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

Why? My best guess is... inside views SharePoint can use the ID to build a URL to the item. To fix your issue, it will probably be easiest for you to just iterate over the DataTable rows and trim off the id;#.


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

I hope you're calling the code in right order. protected override void CreateChildControls() { // you code here Controls.Add(yourgridviewid); //Important to call this after Control.Add... yourgridviewid.PagerTemplate = null; base.CreateChildControls(); }


1

I remember I also had this problem a while ago. And if I remember correctly, the only way to change the format of the date in the filter is to change the regional settings of the site. Go to Site Actions -> Site Settings and under Site Administration you will find Regional Settings. Here you can change under Locale how your date is formatted. For example, ...


1

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


1

It is difficult to troubleshoot since you didn't post all the code... I would make sure your BoundField is setup correctly and the SortExpresssion property is being set to the correct column in your DataTable: BoundField column = new BoundField(); column.DataField = name; column.SortExpression = name; column.HeaderText = name; If that doesn't work, read ...


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.



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