Welcome to my blog. Here I will try my best to provide as much insight into my Sharepoint creations and whatever other creations I can come up with.
Wednesday, February 10, 2010
jQuery Forms Replacement In Sharepoint (Phase III)
Okay, now it is time for a few updates on what I have been able to do and what my final solution is going to look like including the reasons I chose to go that way.
In the last post on this topic, I talked about building the forms either with a Visual Studio webpart or a Dataform webpart from Sharepoint Designer. I talked some on what I had done on the Visual Studio side and now I will talk about what I did on the other side.
First I again create a webpart page to add the webpart to and for this form I wanted to use it for adding new items to a custom task list that I had created.
So I have a page and the list so I then navigated to the page in Sharepoint and chose to edit the page. This allows me to add a webpart and this when it really hit me to try something different. I added a content editor webpart. This is a very powerful webpart. I then used Sharepoint designer to create the html of a form using standard html controls and pasted those into the source editor of the webpart.
Now I have a page that has controls on it and I changed the location of the javascript to the actual PlaceHolderMain content area of the page. This is the javascript that does all the work for getting the data from Sharepoint or updating the data depending on what I am doing. Again I am using the SPServices jQuery library and it really is neat how fast it is at getting and setting the data. This form was very basic as there were no special controls really. It just had a few text boxes and a couple of select boxes. This works great and is a great way to build small forms for displaying and updating certain pieces of data. I am still working on creating a code with code examples but this may be a few weeks from now.
As I said, this does work and I bet I could even get this to work for inline editing of some items directly in the forms or maybe popup a window that does it. Again very useful and I like it.
Now, for the environment that I work in and the tough restrictions placed on it, there are some things that I really can not do in our production environment. The main thing that we are not allowed to do is connect Sharepoint Designer to the site. This really makes it harder to update things or to build webparts that you do not have to export and import. As I mentioned in an earlier post, we have to provide solution packages and we have to have as much of the solution as possible in the package and we use Visual Studio for this.
With that said, I chose to continue to create the forms using VS by creating a .ascx page that has the server controls on it. Using the VseWSS 1.3 extensions I add a new webpart to my solution and in the code-behind page, I attach the .ascx page and get a handle to all the controls. I also connect up the list to this form and prefill the form with the data. This form of course still renders standard controls and I can still use jQuery to do any updating of the data. This method makes it easier if we need to update the form or change it. I do hope to get some code up here soon, but until then, please let me know if you have any questions or feedback. If something is not clear please let me know!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment