anyone out there knows if it's possible to add items to a SP list from a hyperlink?
I would like to have user clicking on a hyperlink that will create and save an item in the list.
something like:
http://www.SP.com/listname/NewForm.aspx?Title=YES&[something to save]
http://www.SP.com/listname/NewForm.aspx?Title=YES will load the new list item with 'Title' already filled in... but how to I save without having to press the Save button?
I am looking at users receiving an email and being able to record their 'like' or 'unlike' by having them to press a hyperlink....
Thanks!
It's conceptually wrong and unsafe. GET request (clicking the link it's a GET, not POST) must be idempotent and must be read only action.
But if you really want to do this - you must add webpart to page, wich will create item relying on url parameters. It may be custom web part with server code or just Content Editor Web Part with javascript code using CSOM (if you on 2010 or 2013 SharePoint).
Related
I have a web page written in ASP.net where it finds a list of employees, displays them in a listview and allow the user to change different statuses for each employee.
On each row I have employee information like name, date of birth, address and then 4 status fields that are displayed as checkboxes and a comment field where the user can type a comment explaining why they changed a certain status.
Currently in Listview, there is an edit, delete button when they click edit, the checkboxes and text field are displayed the user updates them and click save.
asp.net will do a postback to save the changes for this row and then fetches the data again to refresh the list.
The problem I am having is the list is very large (more than 3000 names), so I am using pagination to show 50 to 100 names on each page. This is still a big performance problem because after every line update a query needs to run to fetch those names again, and with ASP.NET the server is generating the html and passing everything to the browser.
The customer wants the page to be mobile friendly too, so I am thinking to redo the page using Angular on front end with web-api or mvc.net on back end that returns JSON.
My question is there an easy way to do this and allow the user to change the status for multiple employees on the same page at once and then click one submit to update all the changes? if I do it this way, there will be less queries to run and it will be faster for the user because they don't have to wait after every line update.
Any examples will be greatly appreciated, unless there is a different way to implement this, in this case please let me know.
I have a thought that may work.
On load render names and use pagination.
Then use ajax to send the post to server and change data in database.
When editing has returned successful then only change the values that have been edited using javascript for the user to view.
I have page where users can select from one or more images. When they are done I would like them to navigate to the next page and what is displayed would be based on the selection from the previous page.
"Selecting" just means that they click the image and it has a CSS class added to it. When they click the link to navigate to the next page I'd like to collect the images that have been selected and pass that information along using either TempData or Session.
In most of the examples I have seen either inputs or the query string is used to pass information from the View to the Controller. How can I pass which elements have a particular class to my controller when a link is clicked?
If you're using a link click, I'd probably just append the selected images to the query string. I'm assuming you don't mind exposing this query string to end users.
I'm sure that's probably not the answer you were looking for. But as you stated I think you're only to legitimate options are passing the values through the query string or using hidden inputs and posting the page to your action by intercepting the link click event.
You said you do not want to post back to servers. You cannot access TempData or Session without posting back to server, so they are out of scope.
You only have client side option, so you want to collect a user's selected items in array.
Once the user clicks to Next Page, you create a query string like this ?ids=1-2-3-4 and retrieve those value at next page.
Other thoughts: Long URL likes this is a bit ugly, and URL has maximum length limit depending on browser. If I'm you, I'll post back to server to collect the selected values. Then use TempData (or some persistent storage).
I have 2 views in my SPA built up using durandal. I have a form (consider basic employee information form) in the first view. Also, I am having a button in the view called "upload" which routes to a different view to upload some documents. Once user finishes uploading, it redirects back to my first view and when it does, the first view reloads (renders) again loosing all my previously entered values. Same is the case when I press browser back button on my second view (the upload page).
Any solution on how I can persist data in this case ?
Thanks.
Posting code would make it a bit easier but I would think you'd need to maybe store what's entered in LocalStorage or something and then retrieve it later?
AmplifyJS can make this easier.
i am facing one problem..
I have a page which has some templates related to user..
User use this template to send email..
User can have option to save this template and then he can load the saved templates...
What i want is on click on "Load Template" link. a new page appears which will display all the saved templates for logged in user. this page can contain grid. on select i want to close this load template page. and pass the text data back to previous page. which will display this template into text field. so that user can use saved templates.
How to do this using Asp.Net
You can do this using JavaScript, assuming the template selection window is opened with a call to window.open(). When the template is selected you can communicate and invoke methods (such as passing back the selected template ID) with code similar to this:
window.opener.templateSelected(selectedTemplateID);
window.close();
Here is information about window.opener
I believe that this may be what you're looking for. It's pretty straight forward and is in C#. It is done in .Net as opposed to client side JS.
I would like to know what is the best way to do a notification in asp.net.
For example I have a form in which the user will provide some data. He then click the save button which call the save methode in my code behind.
In the save method I need to query the database to know if another related object exist. If not I need to notify the user that he will have to create the related object. This does not prevent the user from saving the parent object.
So I would like to do a modal popup telling the user : Hey after Im done saving your change, you will have to open another form and create the child object.
So should I create another NotificationWebform where the user will be redirect after the sava to notify him. It seems to be a "lot" of effort for a little notification. The best thing for me would be something like an alert in javascript.
Thanks!
Just put a lable on the page and display your message in that label after saving the data successfully to the database.
If it doesn't exist let him simply save it. If it already exists then just display that information to the user. Forget the JS alert and the modal pop-up; what if JS is disabled? Either way, just create success and failure messages/panels and display the appropriate one.
Normally, when I used Web Forms, I made all pages inherit from a custom class that extens Page class and inside this base Page class, I have 3 properties, one for SuccessMessage, ErrorMessage and NotificationMessage
Inside the Master Page, you can have 3 Labels and each one has a bootstrap css class according to its type, or maybe you can use toaster (https://github.com/CodeSeven), to show a nice popup like Outlook client.
In your button click event handler, you can simply set the NotificationMessage = "You have to blah blah blah ".
In the base Page class, you will check the value of each of these properties and if it is not empty then you will set the text of the corresponding Label and set Visible = true