I have a asp.net chart which shows some attendance of month.
I have a dropdown which shows the month name. The user will select the month from the dropdown and click on a button.
On this button click, I want to call ActionResult mettod, which will fetch the data from a database of selected month and bind the data to chart(dotnet.highcharts).
I want to know if I can bind data to an asp.net chart with specific values.
Can anyone please let me know how to do this?
Your method would probably return JsonResult in that case. Once you receive that json on the client side (through ajax request e.g.) you would submit it to Highcharts series property.
Related
This is my first dropdown list in my view.:
And this is my controller:
My problem is that whenever I click the available dropdown in my first dropdown list it should populate the data available on the one that I have clicked on the second dropdown list. But It has an error it will not proceed to the next line which the JavaSerializer. How can I fix my code like it will work. I don't know where is the problem is, whether in the ajax? or in my controller?
Please change the select as jQuery("#availability option:selected").val();
- Change the ajax type as GET method in client side
- JavascriptSerializer not required
- remove [httppost] tag from code behind
- check where any error is there in browser console.
and change $('#availability').push("" + this.name+ "");
I am wondering if there is a way to edit a MVC 4 model then reload the view with the new model from jQuery. The basics of what I am trying to do is I have a page that has weeks of dates and text boxes after each date. This page is for a time card site. The model contains the days of the week and the name of the days for that date. What I am want to modify is the dates in the model so if a user is on this week and realizes they forgot to enter there time for last week they can click a button that takes the to enter time for the last week. I have function to get the dates and the days of the week just not sure how to edit the model and reload it.
The site controllers in C# code samples or any idea would be helpful.
You should look into communicating with your server using jQuery/AJAX. Serialize you model into JSON, modify it in your controller and send it back. You can then update your view with the new data.
Please help me out here I have about 1 day experience of C# ASP.NET web dev and I am stuck on something really simple. I am much more experienced in PHP and jQuery.
What I need to do:
Create a GridView and display data from MSSQL DB [done]
Add buttons to each row to enable direct editing of values in two columns [done]
Each row represents a list of equipment that the user can edit/save, and I need to add an extra "Edit Details" button to each row [done]
Upon clicking the "Edit Details" button, I need to pass the id of that list to a new page where user can edit and save the list
I have added a HyperLinkField for the row id to be passed on, in Visual Studio I have tried to config it so that the value can be read on the receiving page with Request.Params["xxxx"] but it is not working.
In PHP I would just create a POST <form> with hidden <input> values and obtain the value by $_POST["xxxx"]
However it seems that all this fancy ASP.NET and Visual Studio DataSource pointer/reference and config things are making things more complicated than I wished.
I greatly appreciate any help given, or any resources that will be helpful for me to transfer my skills in PHP over to ASP.NET with C#.
If you are passing it through query string use
string value = Request.QueryString["id"].ToString();;
If you are passing it through post use
string value = Request.Forms["id"].ToString();
i'm working on a cascading dropdownlist in mvc3, when i used formmethod.post im able to select a value in dropdownlsi1 and based on the that selection im able to get values in dropdownlist2 and after selecting an item in dropdownlist2 , im getting a button which on clicking will give the user a message u have selected X and Y.....this is fine and i have no issue with it
but when i used formmethod.get, im able to get the 1st dropdownlist and based on the selection in the 1st dropdownlist im able to get 2nd dropdownlist nd items in the 2nd dropdownlist, after the selection in the 2nd dropdownlist , i got a button , but after clicking the button, again im seeing the same page when i get when i load the page i.e only the 1t dropdownlist..
In what scenario we should use formmethod.post and formmethod.get?
You use formmethod.get when you make http get request and formmethod.post when you make http post request it is methods of parameters. It seems to me your solution is to pass previous selected values of dropdown lists into the view and initialize helpers with selected values to render them properly.
It could be done with both request types.
You have two actions:
[HttpGet]
[HttpPost]
In first action you load page, if you use Post method, then you send Post data to second action. If you use Get method you just reload form action, it also send data, but they are included in url, like this site.com?param=1&test=2.
GET or POST method? What's the difference between them?
My goal here is to store a list of dates selected in a calandar to a database. The problem with most calendar controls that exist, for asp.net, is I can't get the date that was unselected with multiselect enabled. I can get a list but that is really it. I have decided not to use these because of this.
If I wanted to create my own event using the jQuery calendar below how would I go about doing this? The event would capture the day clicked, if it was unselected or selected, etc. I would use this to add/remove the dates from a collection. It is almost like how the other calendars work except for the remove part. The dates removed would be in it's own list so I know what dates to remove from the database once 'save' is clicked. I hope this is enough information.
http://www.eyecon.ro/datepicker/#about
Using Visual Studio 2005/.NET 2.0. c#
if you wanted to save multiple dates (list), you could:
-use jquery to create 1 input box for selecting date and another list area the selected dates
-on post back, have the server code check the list area for all the selected dates
if you wanted to save only one date, you could:
-use jquery to create 1 input box for selecting date
-on post back, the server code check for the that input box
hope that helps.