Click here to Skip to main content
15,896,154 members
Home / Discussions / JavaScript
   

JavaScript

 
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 
GeneralRe: Sometimes I make something simple into something difficult Pin
mohammad hasnain raza28-Jul-15 1:26
professionalmohammad hasnain raza28-Jul-15 1:26 
QuestionCreating an array of graphic files... Pin
Rayj201025-Jul-15 7:31
Rayj201025-Jul-15 7:31 
QuestionChanging the last text of a loop Pin
Member 1184968824-Jul-15 4:53
Member 1184968824-Jul-15 4:53 
AnswerRe: Changing the last text of a loop Pin
Richard MacCutchan24-Jul-15 5:40
mveRichard MacCutchan24-Jul-15 5:40 
AnswerRe: Changing the last text of a loop Pin
ZurdoDev24-Jul-15 5:58
professionalZurdoDev24-Jul-15 5:58 
AnswerRe: Changing the last text of a loop Pin
Anil Vaghasiya24-Jul-15 19:52
professionalAnil Vaghasiya24-Jul-15 19:52 
QuestionHow do I make the Comment box conditional mandatory box? (SOLVED) Pin
samflex23-Jul-15 8:20
samflex23-Jul-15 8:20 
AnswerRe: How do I make the Comment box conditional mandatory box? Pin
Richard Deeming23-Jul-15 9:04
mveRichard Deeming23-Jul-15 9:04 
GeneralRe: How do I make the Comment box conditional mandatory box? Pin
samflex23-Jul-15 9:14
samflex23-Jul-15 9:14 
GeneralRe: How do I make the Comment box conditional mandatory box? Pin
Richard Deeming23-Jul-15 9:34
mveRichard Deeming23-Jul-15 9:34 
GeneralRe: How do I make the Comment box conditional mandatory box? Pin
samflex23-Jul-15 10:15
samflex23-Jul-15 10:15 
Questionhow to add image in columns in datatables using jquery and json Pin
Member 1185791223-Jul-15 3:56
Member 1185791223-Jul-15 3:56 
QuestionRe: how to add image in columns in datatables using jquery and json Pin
ZurdoDev24-Jul-15 5:59
professionalZurdoDev24-Jul-15 5:59 
QuestionSeeking Former Ford Employees Pin
Member 1185572122-Jul-15 7:09
Member 1185572122-Jul-15 7:09 
QuestionIf ... Else If ... Else statements Pin
Member 1184785021-Jul-15 18:41
Member 1184785021-Jul-15 18: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.