Hi We have to bind the data in web infragistics hiergrical control. so we need some code snipet
You need to instantiate 2 or more data sources and then add relationships and add the primary datasource to the WebGrid:
dataset.Relations.Add("Flags", this.dataset.Tables[0].Columns["ParticipantID"], this.dsParticipants.Tables[1].Columns["ParticipantID"]);
this.uwgParticipants.DataSource = ds.Table[0];
Session["data"] = ds.Table[0];
this.uwgParticipants.DataBind();
Related
Using the Microsoft.SharePoint dll, I can render SP Fields in custom application page using the below server side code.
BaseFieldControl editControl = field.FieldRenderingControl;
editControl.ID = field.Id.ToString()
editControl.ControlMode = SPControlMode.New;
editControl.ListId = list.ID;
editControl.FieldName = field.InternalName;
pnlFields.Controls.Add(editControl);
Now, we're converting our farm solutions to Addins/SPFx. I cannot find an equivalent of the above code via CSOM/JSOM. What is the way to render SP Fields in a custom page via client side programatically (Addins/SPFx) and How?
This will be used in a Batch Edit page, wherein the custom Batch Edit page contains the SP Fields visible in the default edit form of the list. And on the Batch Edit page, the user can input their updates to the items (just like entering inputs on the edit form).
You can't find it because a FieldRenderingControl does not exist in the SPFx world :)
I would highly recommend this sample to see how to dynamically render fields:
https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-list-form
It shows you how to read the list schema and render fields accordingly. You will have to render each field yourself, as well as handle any storing of data after an update. In the sample they have added code for most fieldtypes.
You can also batch these update calls (as you mention batch edit in your question) using the Microsoft graph:
https://learn.microsoft.com/en-us/graph/json-batching
This will save you a bunch of requests as you can do 20 item updates per call by using this.
So I have a layout view within Sitecore Mvc, this view contained a Controller Rendering that pulls in a header and footer navigation. Example:
#Html.Sitecore().Rendering("/sitecore/layout/renderings/some_rendering")
This specifies a Controller Rendering I've defined in Sitecore. This works great, except when I'm in the experience editor. It doesn't give me the ability to select this rendering. If I create a Placeholder and then define these navigation elements to this placeholder dynamically via Sitecore, then I can, but these navigational elements exist on every page of this layout, so I would like them statically placed instead of using a Placeholder, but I would still like the user to be able to select the navigation element in the experience editor (so I can create custom command to interact with this navigation, such as creating new links, etc).
Does anyone have an idea that will help me achieve this?
Use Edit Frame for that and create Custom Edit Frame Button for operations like adding new element to the navigation.
And remember to pass Datarsource ID or Path as a second parameter to the Html.Sitecore().Rendering() method:
#Html.Sitecore().Rendering("/sitecore/layout/renderings/some_rendering", new { DataSource = "{some-id-or-path}" })
Here is set of blog posts which can help you to understand how Edit Frames work and how to add them in Sitecore MVC solution:
https://visionsincode.wordpress.com/2015/01/08/how-to-use-editframe-in-sitecore-mvc/
https://www.cmsbestpractices.com/how-to-properly-use-sitecore-edit-frames/
https://briancaos.wordpress.com/2011/11/28/using-sitecore-editframe-in-pageedit/
You won't be able to remove the component or move it around the page (yeah, it's statically bound to one place on your layout), but you will be able to edit it's properties and datasource.
You can try to use GlassMapper views and statically inherit the view from the GlassView.
Then you'll be able to use Editable method to render the field.
But the consideration you need to take is that you'll not be able to set a datasource to the component from the page editor or content editor.
Instead of injecting the rendering through the Rendering method you should be able to use standart MVC RenderPartial.
I've used this approach on one of the projects I've been on and it worked.
I want to create a Liferay web content which will display selection box of multiple states.
I created one select field in Structure for showing States and gave multiple options such as- Punjab, Karnataka, Keral,....
Now I want to access these select field options in Template.
Can anyone please tell me how to access select field & its options in template?
Thanks in Advance :)
It sounds like you are trying to build portlet functions with web content, which is not what it was made for.
Nevertheless: You can access the structure with
#set($structureService = $serviceLocator.findService("com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService"))
#set($structure = $structureService.fetchDDMStructureByUuidAndGroupId("THE-UUID-OF-YOUR-STRUCTURE", $articleGroupId))
The structure will contain the options for your field (see DDMStructure).
But if you are really into the web content approach - I would move the configuration from the structure to the web content article:
Create a repeatable text field in the structure and add your states in the article itself (form builder approach). Then you can simply configure a different set of options for every article. And you can use the options in the template:
<select name="...">
#foreach ($state in $yourStateFieldName.siblings)
<option value="$state">$state</option>
#end
</select>
Is reading the selected value what you're asking?
For field of type select with name selectionField, just call getData() to read the selected value (as string).
$selectionField.getData()
I'm using sharepoint 2013 and i want to utilize the client side rendering feature using JSLink, when editing the web part for the calendar new event, in the "miscellaneous" there is no field for JSLink, how to modify the render for new event using JSLink ?.
It is not possible. See this discussion.
After about an hour's worth of research I found the problem. Microsoft specifically targets the Invalid, Event, and Survey list types to ignore client rendering. Unless you create your own webpart you will not ever be able to use any of the JSLink properties for these list types. Maybe somebody at Microsoft can explain themselves here as to why they would have crippled us like that or what a proper approach for this common problem would be. Yet another reason the Calendar is a piece of garbage in SharePoint 2013!
Also this answer:
There is no OOTB way to attach Javascript with calendar view (no property exposed for that listview). For a workaround you can create your own JQUERY or JAVASCRIPT and add on calendar view page by adding the reference in Content Editor Webpart on that page.,
However I have a quick but dirty solution. Add a SriptEditor to yout page, below the calendar and insert:
var oldEditLink = EditLink2;
EditLink2 = function(a,b,c){
if (isNaN(b) && b.substring(0,3) == "WPQ"){
var itemId = a.getAttribute("href").split("=")[1];
// do what you want to do
return false;
}
oldEditLink(a,b,c);
}
I'm using Sitecore 7.1 with MVC.
I need to get the item ID of the sublayout or rendering used for a particular Sitecore items.
Is there a way i fetch list of sublayouts/rendering used by an item in sitecore using .net.
Could some post the necessary code for that.
Thanks
The traditional way to get an array of renderings prior to Sitecore MVC is:
Sitecore.Context.Item.Visualization.GetRenderings(Sitecore.Context.Device, false)
I believe this will return a list of renderings in both a WebForms and MVC context.
Specific to MVC, you can also get a list of renderings by using the current RenderingContext or PageContext via:
RenderingContext.Current.PageContext.PageDefinition.Renderings
or
PageContext.Current.PageDefinition.Renderings
Please try below code
Sitecore.Context.Database.GetItem(((Sublayout)Parent).RenderingID);
Also see Using the DataSource Field with Sitecore Sublayouts.