My main goal with SharePoint is quite simple, I want to develop an intranet heavily based on tables and forms by using a tool/designer which doesn't force me to code all new/edit forms for List entries.
Presently I have a custom form in SharePoint designer to edit a list entry and I would like to add server side code (c#) in order to implement some specific behavior, for instance run a custom Page_Load function.
The issue is that I'm not sure how to do it and which would be the best approach, most of the examples online show an approach using Visual Studio and creating a new list (couldn't even find a way to use an existing SharePoint list) and then code the forms from scratch which I don't want.
So how can I enhance the SharePoint Designer pre-built form (image below) with server side (c#) and client side code (js) ? If possible I would prefer to do it with Visual Studio but I didn't find a way to start customizing an existing Form aspx from VS.
My suggestion... if you don't mind using Server Object Model, you could use a Visual WebPart. It's encapsulated and promotes code reusability. From there, you could include client side code, or server side code. Personally I prefer VS to do this, but if you prefer SD, here is a walkthrough https://msdn.microsoft.com/en-us/library/ee231546.aspx
And here is a link on how to include it within an application page
Add a WebPart to an Application page
Hope this helps a bit
Related
Can anyone point me in the direction of some potted WPF controls for interacting with SharePoint fields? Ideally, they should have comparable functionality to the HTML fields defined in the SharePoint XML namespace used in SharePoint designer. An ideal scenario would be to include similar syntax to the server-side defined HTML elements referencing a field in a list, and let the control decide what sort of data it needs to represent, and whether it needs to be editable or not.
In particular, I need it to support:
A people finder field that allows people to be identified from their names, email addresses, or usernames, much like the default HTML form element.
A formatted text field that provides basic formatting tools in the ribbon, as well as being able to provide the formatted text back as HTML (because this is how it seems to get stored in SharePoint).
Text boxes (single/multiline), combo boxes, and radio buttons (but these are all relatively easy, because they already exist as WPF controls)
In addition, values need to available in a way that allows me to push them back to the server and expect items to update. This is most important for formatted text and user "people" fields, since their displayed value is often quite different from the actual value (e.g. includes indexes to the UID for the user, or includes HTML respectively).
At present, following a lack of responses to a similar question on SharePoint StackExchange, I'm hosting the existing SharePoint forms in a WebBrowser control, which is, fairly obviously a pretty sub-optimal solution (mostly for UX and stability reasons); worst case, I can inject some CSS into the pages being displayed to hide them, but I'd really rather be abel to build something that's relatively robust.
SharePoint 2010 has provided both the Server Object and Client Object model using which a developer can use a client interface like WinForm or WPF and interact with SharePoint 2010 Web Applications, as well as work with SharePoint Objects. SharePoint 2010 has also provided Web Services and WCF services using which any client UI application can interact with it.
To use client object model, SharePoint 2010 has provided the following assembly references:
Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.Runtime.dll
You can find these references from the following path:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI
And for 2013:
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI
Sources:
http://www.dotnetcurry.com/showarticle.aspx?ID=761
http://www.dotnetcurry.com/showarticle.aspx?ID=758
This said, have you considered to do this using the content editor web part and JavaScript / jQuery and incorporate the app into the SharePoint stack?
Here is a similar question answered
Hope this helps!
I've been researching on this and read some of previous Q&As but they are somehow very abstracts. Suppose I have an ASP.NET site (Web Form with Master Page) and I want to integrate this Excel form which it is easier for me to emulate in Info Path in my ASP.NET site(non-sharepoint environment). Is it possible for me to create this form in Info Path and added it to my ASP.NET Web Form?
Thanks a lot for your help.
First you need to see that how InfoPath form works. its not the same way as Web Forms. InfoPath forms are xml based forms, these xml based forms are easy to integrate in SharePoint as the data in xml format along with the template is stored in database, but Web form's functionality is different. As for as your question can you please elaborate more how you want to integrate excel form with WebForm.
thanks
You can create InfoPath forms to submit to a web service or a Database (start by opening InfoPath Designer and you'll see a bunch of options for advanced templates), plus InfoPath forms store data in good old XML, so you can use pretty much any scripting/server-side technology to parse them if you know where they're stored...
In short the answer is definitely yes, you can use InfoPath forms in non-SharePoint environments, you just have to do the legwork to setup where they submit and then how you fetch that data yourself.
This will probably sound dumb, but I need to execute a C# code from my html file. For example I just want to execute this
System.Diagnostics.Process.Start(#"D:\Movies\HurtLocker.avi");
Not any server side code.
I can't create aspx page, because to open an aspx page in a browser it needs to be hosted in IIS.
You can't execute server side code from a client side page. If your page is aspx you can use a webservice or click a serverside button from javascript.
Edit: If you want to embed a video player please check this link. You don't need server side code for this. You'll be able to do it with javascript.
Where do you want the c# code to run?
If you want it to run in the browser that is being used to render the html then I'd say that was basically not possible. Something, presumably javascript code in the html page, would have to somehow instantiate a .net clr and pass the c# code to it for execution. The clr does have a COM-based hosting interface that would allow instantiation, but even if you could call this from javascript I think that any sensible browser security settings would prevent it.
If you want the c# to run on the server supplying the html page then you should use asp.net.
EDIT
Ok, you want to run it in the browser. I'm not aware of any examples for hosting a clr in the browser process, sorry.
You can create activex/com objects in js using something like var obj=new ActiveXObject("<comclassname>");, and you might be able to create a CLR that way by instantiating one of the COM classes (maybe CLRRuntimeHost) listed on this page. You could then pass your c# code to your clr for execution. More info here and here. I'm really not sure if that would work, though. I've never used the hosting api, I just know it exists!
Seems like an interesting project to try if you are curious, but deploying this in a real environment would likely present lots of problems. Good luck!
Not C#, but how about .NET dynamic language in the browser with Gestalt? http://gestalt.codeplex.com/
You can create a code block in your ASP file but if this is simple HTML file this is not possible.
At least you will have some application that will read the content of the page compile it and execute.
ASP code block
As Pabuc mentioned you can't execute server side code on the client machine in HTML. If you were to use Silverlight you could execute the code client side, but then the client need to have Silverlight installed and it is not strictly HTML anymore.
Silverlight could be used to play movies client side with C#.
The only way to have C# on client side is Silverlight application [update] or any other browser plugin as #kenny mentioned.
I have tried to find a software for this some time. I have software, which has needs, that are hard to make with traditional Web programming.
Now I have made simple demo, how to create HTML5 online application with C# or VB.NET.
It is Scot library which translates C# to Javascript on time when executing .NET application. It also supports events on Browsers, which is executed in c# code.
To original question:
On the Html page you will need to add single line after :
<script src="myclass.cs"> </script>`
to connect .Net class:
using Scot;
//..
public myclass:Document
{
protected override OnConnect()
{
Elements["mybutton"].OnClick+=new JsInputEventHandler(click);
//your initialization //....
}
private void click(object sender, JsInputEventArgs e)
{
Window.Alert("Click()");
}
}
Demos are quite simple, but actually I needed this library for another project.
It would be nice to have any feedback.
I have the database mysql.
I need to access it via a desktop application with the ability to change does not have value.
in asp.net is there, this dynamic data filter, I need the same thing but in WPF.
Visual Studio has lots of easy tools to help you integrate your SQL Server into the application from using things like the DataGridView to the DataRepeater take a look at this article http://www.codeproject.com/KB/WPF/wpfviews.aspx it should help you get started. Using LINQ to assist in speed application development.
Another Great link: http://dotnetslackers.com/articles/wpf/WPFDataBindingWithLINQ.aspx
In MOSS 2007, is there a way I can insert a piece of code I wrote to run every time I create a site from a ready made template ??
You should do it with a feature, and give it a feature receiver that contains your code. Attach the feature to the site template. If you've made the template yourself, you can simply add it to its onet.xml. If it's a standard template, you can use feature stapling, which connects your new feature to an existing site template.
Note that in either case, your code will not run for sites that exist already, (unless you manually activate the feature there.)
Yes, you certainly can. I wrote a post on this a few months back. You have two options, either a feature with a feature activated handler, or using a ProvisionAssembly in your site defintions webtemp*.xml file. The latter is also how MOSS does the Publishing portal multi-site setup.
I wrote a short article on this a few months back:
http://furuknap.blogspot.com/2008/06/question-from-forum-post-at-httpwww.html
.b