Click here to Skip to main content
14,495,987 members
   

ASP.NET

 
GeneralRe: Name of the software that can package websites to install on smartphones: android and iphone ? Pin
Richard MacCutchan9-Jan-20 23:08
mveRichard MacCutchan9-Jan-20 23:08 
QuestionScrape with htmlagilityapck question Pin
Member 17532506-Jan-20 12:10
MemberMember 17532506-Jan-20 12:10 
SuggestionRe: Scrape with htmlagilityapck question Pin
ZurdoDev7-Jan-20 9:04
mveZurdoDev7-Jan-20 9:04 
GeneralRe: Scrape with htmlagilityapck question Pin
Member 17532507-Jan-20 9:57
MemberMember 17532507-Jan-20 9:57 
QuestionRe: Scrape with htmlagilityapck question Pin
ZurdoDev11-Jan-20 8:55
mveZurdoDev11-Jan-20 8:55 
AnswerRe: Scrape with htmlagilityapck question Pin
Member 175325011-Jan-20 9:36
MemberMember 175325011-Jan-20 9:36 
QuestionAssigning data from sql database to a chart C# and entity framework Pin
Member 146959565-Jan-20 22:07
MemberMember 146959565-Jan-20 22:07 
AnswerRe: Assigning data from sql database to a chart C# and entity framework Pin
Richard Deeming7-Jan-20 9:08
mveRichard Deeming7-Jan-20 9:08 
Loading data from the database is best done in the controller, rather than the view.

Assuming you're using raw ADO.NET to access the database, something like this should work:

Controller:
public ActionResult YourAction()
{
    var xValues = new List<string>();
    var yValues = new List<string>();
    
    using (var connection = new SqlConnection("... YOUR CONNECTION STRING HERE ..."))
    using (var command = new SqlCommand("SELECT ConDate, ConUnits FROM TBL_MYdata ORDER BY ConDate", connection))
    {
        connection.Open();
        
        using (var reader = command.ExecuteReader(CommandBehavior.CloseConnection))
        {
            while (reader.Read())
            {
                xValues.Add(Convert.ToString(reader["ConDate"]));
                yValues.Add(Convert.ToString(reader["ConUnits"]));
            }
        }
    }
    
    var model = new Chart(width: 600, height: 400, theme: ChartTheme.Green)
        .AddTitle("Product Life Cycle")
        .AddSeries(name: "Employee", chartType: "Spline", xValues: xValues.ToArray(), yValues: yValues.ToArray());
    
    return View(model);
}
View:
@model Chart
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    Model.Write();
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

QuestionCan i use timer control without use java sicrpt? Pin
Nowiglah4-Jan-20 6:26
MemberNowiglah4-Jan-20 6:26 
AnswerRe: Can i use timer control without use java sicrpt? Pin
Eddy Vluggen4-Jan-20 8:36
professionalEddy Vluggen4-Jan-20 8:36 
QuestionTrying to open a pdf file in a new Tab on Chrome browser - not happening Pin
simpledeveloper3-Jan-20 5:59
Membersimpledeveloper3-Jan-20 5:59 
AnswerRe: Trying to open a pdf file in a new Tab on Chrome browser - not happening Pin
ZurdoDev3-Jan-20 6:29
mveZurdoDev3-Jan-20 6:29 
GeneralRe: Trying to open a pdf file in a new Tab on Chrome browser - not happening Pin
simpledeveloper3-Jan-20 6:50
Membersimpledeveloper3-Jan-20 6:50 
GeneralRe: Trying to open a pdf file in a new Tab on Chrome browser - not happening Pin
ZurdoDev3-Jan-20 6:52
mveZurdoDev3-Jan-20 6:52 
GeneralRe: Trying to open a pdf file in a new Tab on Chrome browser - not happening Pin
simpledeveloper3-Jan-20 7:01
Membersimpledeveloper3-Jan-20 7:01 
GeneralRe: Trying to open a pdf file in a new Tab on Chrome browser - not happening Pin
ZurdoDev3-Jan-20 7:06
mveZurdoDev3-Jan-20 7:06 
GeneralRe: Trying to open a pdf file in a new Tab on Chrome browser - not happening Pin
simpledeveloper3-Jan-20 7:34
Membersimpledeveloper3-Jan-20 7:34 
GeneralRe: Trying to open a pdf file in a new Tab on Chrome browser - not happening Pin
ZurdoDev3-Jan-20 7:46
mveZurdoDev3-Jan-20 7:46 
GeneralRe: Trying to open a pdf file in a new Tab on Chrome browser - not happening Pin
simpledeveloper3-Jan-20 7:56
Membersimpledeveloper3-Jan-20 7:56 
GeneralRe: Trying to open a pdf file in a new Tab on Chrome browser - not happening Pin
simpledeveloper3-Jan-20 9:08
Membersimpledeveloper3-Jan-20 9:08 
QuestionHow I can insert data into gridview without use data source??? Pin
Nowiglah3-Jan-20 4:34
MemberNowiglah3-Jan-20 4:34 
AnswerRe: How I can insert data into gridview without use data source??? Pin
ZurdoDev3-Jan-20 6:30
mveZurdoDev3-Jan-20 6:30 
GeneralRe: How I can insert data into gridview without use data source??? Pin
Nowiglah4-Jan-20 6:16
MemberNowiglah4-Jan-20 6:16 
AnswerRe: How I can insert data into gridview without use data source??? Pin
ZurdoDev4-Jan-20 7:46
mveZurdoDev4-Jan-20 7:46 
QuestionError: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl) Pin
Member 24584672-Jan-20 20:41
MemberMember 24584672-Jan-20 20:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.