Hot answers tagged spgridview
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
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
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
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
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 ...
1
Yes it is possible, but you will need to implement sorting, filtering and paging yourself.
This CodePlex project includes som basic examples.
The key is that an SPQuery called on a list by
list.getItems(yourSPQuery)
(MSDN) will return list items that you can use to populate a DataTable or other datasource for the SPGridView
1
If table you want to bind SPGridView control with is SQL table then you can simply bind SPGridView with your SQL table, I would explain it in details but its already explained properly in this similar type of question,
Sharepoint SPGridView Data Reneder-SQL
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
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?
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
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
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
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
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.
Only top voted, non community-wiki answers of a minimum length are eligible



