Click here to Skip to main content
15,921,793 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: 'undefined' is a flaw in JavaScript Pin
le_top3-Aug-15 4:54
le_top3-Aug-15 4:54 
AnswerRe: 'undefined' is a flaw in JavaScript Pin
Kornfeld Eliyahu Peter3-Aug-15 7:37
professionalKornfeld Eliyahu Peter3-Aug-15 7:37 
GeneralRe: 'undefined' is a flaw in JavaScript Pin
le_top3-Aug-15 8:09
le_top3-Aug-15 8:09 
AnswerRe: 'undefined' is a flaw in JavaScript Pin
Kornfeld Eliyahu Peter4-Aug-15 21:16
professionalKornfeld Eliyahu Peter4-Aug-15 21:16 
SuggestionRe: 'undefined' is a flaw in JavaScript Pin
camycentsolutions5-Aug-15 23:40
camycentsolutions5-Aug-15 23:40 
QuestionSimple Slideshow Pin
Alex Mander30-Jul-15 6:20
Alex Mander30-Jul-15 6:20 
QuestionJava Script Pin
jubayer30-Jul-15 3:15
jubayer30-Jul-15 3:15 
AnswerRe: Java Script Pin
Afzaal Ahmad Zeeshan30-Jul-15 4:07
professionalAfzaal Ahmad Zeeshan30-Jul-15 4:07 
QuestionIncrementing/Decrementing not by 1 Pin
Member 1184785029-Jul-15 19:14
Member 1184785029-Jul-15 19:14 
AnswerRe: Incrementing/Decrementing not by 1 Pin
Peter_in_278029-Jul-15 20:27
professionalPeter_in_278029-Jul-15 20:27 
QuestionOK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Marc Clifton28-Jul-15 15:19
mvaMarc Clifton28-Jul-15 15:19 
QuestionRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Richard Deeming29-Jul-15 1:50
mveRichard Deeming29-Jul-15 1:50 
AnswerRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Marc Clifton29-Jul-15 4:39
mvaMarc Clifton29-Jul-15 4:39 
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Richard Deeming29-Jul-15 4:47
mveRichard Deeming29-Jul-15 4:47 
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Marc Clifton29-Jul-15 5:09
mvaMarc Clifton29-Jul-15 5:09 
AnswerRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Afzaal Ahmad Zeeshan29-Jul-15 5:20
professionalAfzaal Ahmad Zeeshan29-Jul-15 5:20 
AnswerRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
F-ES Sitecore30-Jul-15 22:22
professionalF-ES Sitecore30-Jul-15 22:22 
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Richard Deeming31-Jul-15 0:40
mveRichard Deeming31-Jul-15 0:40 
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
F-ES Sitecore31-Jul-15 1:03
professionalF-ES Sitecore31-Jul-15 1:03 
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
Richard Deeming31-Jul-15 1:04
mveRichard Deeming31-Jul-15 1:04 
GeneralRe: OK, Javascript gurus, why is "if" not evaluating as true or false ? Pin
F-ES Sitecore31-Jul-15 1:11
professionalF-ES Sitecore31-Jul-15 1:11 
QuestionNeed to get client system date and time format Pin
pk.pradeep28-Jul-15 4:07
pk.pradeep28-Jul-15 4:07 
QuestionDisplay data from SQL database to HTML page in table format using Angular JS Pin
iamcpmember27-Jul-15 0:38
professionaliamcpmember27-Jul-15 0:38 
Hi,

I want to fetch data from SQL database, and display the same on my HTML page in table format using Angular JS.

I am able to get the data in the scope variable, but it is not getting displayed in the HTML page.

Please check the code that I have written below, and help me fixing the issue.

Thanks in advance.

HTML code:



<html>

<head>

<title>:: View Logs ::</title>

<script src="Scripts/angular.js"></script>
<script src="Scripts/angular.min.js"></script>



<script src="Scripts/logsController.js"></script>
<script src="Scripts/jquery-2.1.1.js"></script>
<script src="Scripts/jquery-2.1.1.min.js"></script>



</head>

<body>







Log IDUser TypeUser NameEmail IDAction TypeSection NameSection DetailsDateTimeUser IP
{{item.LogID}}{{item.UserType}}{{item.UserName}}{{item.EmailID}}{{item.ActionType}}{{item.SectionName}}{{item.SectionDetails}}{{item.DateTime}}{{item.UserIP}}






</body>

</html>






logsController.js code:


angular.module('ViewLogsApp', [])
.controller('ViewLogsController', [
'$scope', function ($scope) {

$scope.logslist = [];

$scope.load;

$scope.load = function () {

$.ajax({
type: 'GET',
contentType: 'application/json; charset=utf-8',
url: 'UserActivityLogs.aspx/getList',
success: function (data) {
$scope.logslist = data
$scope.$apply();
}
});
}
$scope.load();

}
]);





WebMethod code:


[System.Web.Services.WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public static List<useractivitylogslist> getList()
{
SqlConnection con = new SqlConnection();

con.ConnectionString = _connstr;
con.Open();

var logs = new List<useractivitylogslist>();

string get = "select * from UserActivityLogs";
//string get = "sp_employee";

SqlCommand cmd = new SqlCommand(get, con);

SqlDataReader dr = cmd.ExecuteReader();

while (dr.Read())
{
UserActivityLogsList e = new UserActivityLogsList();

e.LogID = Convert.ToInt32(dr[0]);
e.UserType = Convert.ToString(dr[1]);
e.UserName = Convert.ToString(dr[2]);
e.EmailID = Convert.ToString(dr[3]);
e.ActionType = Convert.ToString(dr[4]);
e.SectionName = Convert.ToString(dr[4]);
e.SectionDetails = Convert.ToString(dr[4]);
e.DateTime = Convert.ToString(dr[4]);
e.UserIP = Convert.ToString(dr[4]);

logs.Add(e);

}

con.Close();

return logs;

}
Clouds come floating into my life, no longer to carry rain or usher storm, but to add color to my sunset sky. ~Rabindranath Tagore

AnswerRe: Display data from SQL database to HTML page in table format using Angular JS Pin
mohammad hasnain raza28-Jul-15 1:21
professionalmohammad hasnain raza28-Jul-15 1:21 
RantSometimes I make something simple into something difficult Pin
Member 1183686426-Jul-15 7:38
Member 1183686426-Jul-15 7:38 

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.