Click here to Skip to main content
15,894,955 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: i have issue for calculating Total in Grid control of ASP.net Pin
User 41802543-Aug-15 10:17
User 41802543-Aug-15 10:17 
QuestionOnly authenticate user can access the authenticated page otherwise redirect to login page uaing ASP.NET webfroms Pin
Member 1115728828-Jul-15 21:40
Member 1115728828-Jul-15 21:40 
AnswerRe: Only authenticate user can access the authenticated page otherwise redirect to login page uaing ASP.NET webfroms Pin
Wendelius28-Jul-15 21:47
mentorWendelius28-Jul-15 21:47 
Questioncalculate the weighted average Pin
jkirkerx27-Jul-15 13:43
professionaljkirkerx27-Jul-15 13:43 
AnswerRe: calculate the weighted average Pin
Kenneth Haugland28-Jul-15 1:19
mvaKenneth Haugland28-Jul-15 1:19 
AnswerRe: calculate the weighted average Pin
deepankarbhatnagar28-Jul-15 2:14
professionaldeepankarbhatnagar28-Jul-15 2:14 
GeneralRe: calculate the weighted average Pin
jkirkerx28-Jul-15 6:25
professionaljkirkerx28-Jul-15 6:25 
QuestionDisplay data from SQL database to HTML page in table format using Angular JS Pin
iamcpmember27-Jul-15 0:21
professionaliamcpmember27-Jul-15 0:21 
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:

<!DOCTYPE html>

<html>

<head>

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

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

<!--<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/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>

<!--<script>
ViewLogsApp = angular.module('ViewLogsApp', []);
ViewLogsApp.controller('ViewLogsController', function ($scope, $http) {
$http.get('data.json').success(function (response) {
$scope.myData = response;
});
});
</script>-->

</head>

<body>

<div ng-app="ViewLogsApp">

<div ng-controller="ViewLogsController">

<table class="table table-striped">

<tr>
<th>Log ID</th>
<th>User Type</th>
<th>User Name</th>
<th>Email ID</th>
<th>Action Type</th>
<th>Section Name</th>
<th>Section Details</th>
<th>DateTime</th>
<th>User IP</th>
</tr>

<tr ng-repeat="item in logslist">
<td>{{item.LogID}}</td>
<td>{{item.UserType}}</td>
<td>{{item.UserName}}</td>
<td>{{item.EmailID}}</td>
<td>{{item.ActionType}}</td>
<td>{{item.SectionName}}</td>
<td>{{item.SectionDetails}}</td>
<td>{{item.DateTime}}</td>
<td>{{item.UserIP}}</td>
</tr>

</table>

</div>

</div>

</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

QuestionApplied css styles showing wrong in mozilla firefox Pin
Member 920164824-Jul-15 2:50
Member 920164824-Jul-15 2:50 
AnswerRe: Applied css styles showing wrong in mozilla firefox Pin
jkirkerx24-Jul-15 9:29
professionaljkirkerx24-Jul-15 9:29 
GeneralRe: Applied css styles showing wrong in mozilla firefox Pin
Member 92016485-Aug-15 21:25
Member 92016485-Aug-15 21:25 
Questionhiding label and textbox after update Pin
spirospap22-Jul-15 19:16
spirospap22-Jul-15 19:16 
AnswerRe: hiding label and textbox after update Pin
Blikkies23-Jul-15 0:46
professionalBlikkies23-Jul-15 0:46 
GeneralRe: hiding label and textbox after update Pin
spirospap23-Jul-15 12:11
spirospap23-Jul-15 12:11 
SuggestionRe: hiding label and textbox after update Pin
ZurdoDev23-Jul-15 3:26
professionalZurdoDev23-Jul-15 3:26 
QuestionTrying to prevent the first dropdownlist value changing my database field unless I need to in C# Pin
Norris Chappell22-Jul-15 16:30
Norris Chappell22-Jul-15 16:30 
AnswerRe: Trying to prevent the first dropdownlist value changing my database field unless I need to in C# Pin
Herman<T>.Instance23-Jul-15 11:06
Herman<T>.Instance23-Jul-15 11:06 
GeneralRe: Trying to prevent the first dropdownlist value changing my database field unless I need to in C# Pin
Norris Chappell23-Jul-15 18:23
Norris Chappell23-Jul-15 18:23 
GeneralRe: Trying to prevent the first dropdownlist value changing my database field unless I need to in C# Pin
Herman<T>.Instance23-Jul-15 20:51
Herman<T>.Instance23-Jul-15 20:51 
Questionquery Pin
saif.rashid21-Jul-15 22:35
saif.rashid21-Jul-15 22:35 
AnswerRe: query Pin
Blikkies21-Jul-15 23:13
professionalBlikkies21-Jul-15 23:13 
AnswerRe: query Pin
F-ES Sitecore22-Jul-15 0:40
professionalF-ES Sitecore22-Jul-15 0:40 
AnswerRe: query Pin
Richard Deeming22-Jul-15 1:42
mveRichard Deeming22-Jul-15 1:42 
GeneralRe: query Pin
Herman<T>.Instance22-Jul-15 22:42
Herman<T>.Instance22-Jul-15 22:42 
QuestionDevExpress ASpx Gridview Row Selection on keyboard Arrow key Pin
hemant kolekar20-Jul-15 19:33
hemant kolekar20-Jul-15 19:33 

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.