Add a checkbox to each row of a ListViewWebpart - sharepoint

I'm working on a WSS 3 site that has a ListViewWebpart displaying various columns.
I need to add a checkbox to each row and a button to the header that will perform a server side action for the selected rows.
Do I need to make my own custom webpart or can the ListViewWebpart support checkboxes?
Adding checkboxes to each row
I've found a post Checkbox in ListViewWebpart which suggests
...to add a checkbox, to select multiple
listitem, in the custom list, declare
a xml string as follows.
<Field Type="Computed" ReadOnly="TRUE" Name="ListItemSelection" DisplayName="Select" Sortable="FALSE" Filterable="FALSE" EnableLookup="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ListItemSelection">
<FieldRefs>
<FieldRef Name="ID" />
</FieldRefs>
<DisplayPattern>
<HTML><![CDATA[<input type="checkbox" ]]></HTML>
<HTML><![CDATA[LItemId="]]></HTML>
<Column Name="ID" HTMLEncode="TRUE" />
<HTML><![CDATA["/> ]]></HTML>
</DisplayPattern>
</Field>
and call the
list.Fields.AddFieldAsXml(“xml
string”);. Include this as a first
column in your custom list’s view.
I'm assuming the latter part requires a SPList. E.g.
SPList list = SPContext.Current.Web.Lists["MyList"];
list.Fields.AddFieldAsXml(stringWithXmlFieldDefinition);
Adding a button to the header row
One option for the header button is a CustomAction. This should create a button in the toolbar.

Here is a post to create a custom web part, then you can add a check box to your custom web part using the post you have found (Checkbox in ListViewWebpart).
Be aware that,list.Fields.AddFieldAsXml(stringWithXmlFieldDefinition); can end up adding many duplicated check boxes to you sharepoint. The duplicated can be deleted from database and are located at AllLists table, tp_Fields column.
To find the right fields, you can search by the list guid.
declare #xmlString as xml
Select #xmlString = tp_Fields
From [WSS_Content].[dbo].[AllLists]
Where tp_id ='xxxx'
Select #xmlString
then, update the fields
declare #string as varchar(max)
set #string ='new value without duplicated checkbox'
UPDATE [WSS Content] . [dbo] . [AlILists)
SET [tp_Fields] = #string
WHERE tp_ID = 'xxx'
You can simply add a button by
ToolBarButton newbtn = (ToolBarButton)Page.LoadControl("~/_CONTROLTEMPLATES/ToolBarButton.ascx");
but possibly you need create another toolbar to hold the button, you can even create your own toolbar. You just need to put it in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\YourCutomToolBar.ascx

Related

Create dropdown list jsf

Currently i'm stuck in create two dropdown list in jsf by click a "Add" button.
Initial i have a form with two dropdownlist, a "Add" button and a "submit" button.
The first dropdownlist is list country. The second dropdownlist is list city.
When user choose a country then the second dropdownlist will add dynamic city of this country(i done this using ajax f:ajax).
how can i add two other dropdownlist(list country and list city also) when add button clicked?(it mean user can add a lot of pair dropdownlist using add button)
how about structure of bean to manage all pair dropdownlist when i click submit button?
Please give me some example code to do it.
Thanks
Have you tried using c:forEach? Similar to the following:
<c:forEach var="i" begin="1" end="#{bean.numberOfAddsCLicked}" step="1">
<!-- Your elements to repeat here. Probably bind their values to bean.country[i] respective bean.city[i] with country and city being arrays of bean.numberOfAddsCLicked -->
</c:forEach>

displaytag exporting showing whole HTML tag(for hyperlink)

I'm using displaytag tld for displaying tables and exporting.
The problem is, in my first column, the column content is hyperlink,
and all of this html tag is generated on exporting.
<a class="ajax"
id="msgIDPkView"
href="displaySelect
DashboardDetailsV
iewFullText.do?ref=
501250">501250</
a>
How can I make it only show the value(between ).
if you only decorator for this column use this:
<display:setProperty name="export.decorated" value="false"/>
with this property the decorator doesn't apply to your column while printing!
otherwise you've to create two columns for this property; one to show in web browser and one to show in export!
<display:column property="id" media="html">
<display:column property="id" media="csv">

Multiple lines of text column not showing in Content query webpart sharepoint

I want to add custom column Document Description in CQWP for this I added below code in ItemStyle.xsl
xsl:value-of select="#Document_x0020_Description" disable-output-escaping="yes"
In wepart I used below code
property name="CommonViewFields" type="string">Document_x0020_Description,Note
but even after doing this CQWP not showing its value, it is coming blank but when I do same steps for "Single line of text" type column then in that case all are workin fine.
Please let me know how to add Multiple lines of text column in CQWP
Try also setting the properties "DataMappingViewFields" and "DataMappings" in the webpart like:
<property name="DataMappings" type="string">LinkUrl:{94f89715-e097-4e8b-ba79-ea02aa8b7adb},FileRef,Lookup;|Description:{691b9a4b-512e-4341-b3f1-68914130d5b2},ShortComment,Text;|ImageUrl:{b9e6f3ae-5632-4b13-b636-9d1a2bd67120},EncodedAbsThumbnailUrl,Computed;{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},PublishingRollupImage,Image;|Title:{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Title,Text;|Ingress:{C0ECDC73-85A2-478B-823D-B882219ACA8A},Ingress,Note;|</property>
<property name="DataMappingViewFields" type="string">{94f89715-e097-4e8b-ba79-ea02aa8b7adb},Lookup;{b9e6f3ae-5632-4b13-b636-9d1a2bd67120},Computed;{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},Image;{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Text;{691b9a4b-512e-4341-b3f1-68914130d5b2},Text;{C0ECDC73-85A2-478B-823D-B882219ACA8A},Note;</property>
The last property here called "Ingress" is a Note-field. Maybe this will make the field available in the xsl?

SharePointWebControls:BooleanField - text inside checkbox

I'm trying to brand a sharepoint site, and in edit mode I got several checkboxes. In some of the checkboxes I want to display text, how?
ex:
<SharePointWebControls:BooleanField ID="Comments" runat="server" FieldName="Comments" />
Text I want to insert into the checkbox "this is a comment"
I've tried
<SharePointWebControls:BooleanField ID="Comments" runat="server" FieldName="Comments" />this is a comment</SharePointWebControls:BooleanField>
You might consider creating a content type for your page layout. This content type can have a field named "Comments" and with a custom display name.

SSRS One Page Per Row

I created a new report with a datasource that is returning 100 rows.
In the layout I just drag over a few columns in, no toolbox control. But in preview and deploy I only get one page output with the first row.
What exactly do I need to do so that it renders One Page Per Row?
Not sure if it matters, but my data source is a SharePoint list Web service and I'm using a CAML Query to select data. I do see the records in the Data section in design mode.
<Query>
<SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
<Method Namespace="http://schemas.microsoft.com/sharepoint/soap/"
Name="GetListItems">
<Parameters>
<Parameter Name="listName">
<DefaultValue>{xxxxxxxxxxxxxxxxxxxx}</DefaultValue>
</Parameter>
</Parameters>
</Method>
<ElementPath IgnoreNamespaces="True">*</ElementPath>
</Query>
When you drag a field onto a blank area of the report, BIDS creates a textbox and then inserts an aggregate function (SUM or FIRST depending on field type, I think.)
It sounds like the best way to get what you want will be to first drag a List from the toolbox, then layout your textfields inside the rectangle.
Now insert page breaks by right clicking on the (Details) row group (lower pane of BIDS window.) Select Group Properties.
In the resulting dialog, go to Page Breaks and select the check box for Between each instance of a group.

Resources