|
guestUser cannot access the authenticate webpage and i tried web.config and rolebased authentication using weborms but both are not working?
using Request.IsAuthenticated && !string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]) its working but after logining user if i click same link its redirecting to login webpage.
Anyone give suggestions in this?
|
|
|
|
|
|
I sort of need to calculate the average of all the averages in a report.
I have no clue how to do this, but I do have data.
Do I have enough data here to do this, and perhaps some help with the formula
I saw a couple of examples, but wow it looked so complex.
http://study.com/academy/lesson/calculating-weighted-average-method-formula-example.html[^]
If (sCIR.Length > 0) Then
For idx As Integer = 0 To sCIR.Length - 1
rs_DataRow = rs_Table.NewRow()
rs_DataRow(0) = sCIR(idx).FITEMNO
rs_DataRow(1) = sCIR(idx).FDESCRIPT
rs_DataRow(2) = sCIR(idx).FSHIPQTY
rs_DataRow(3) = sCIR(idx).FCOST
rs_DataRow(4) = sCIR(idx).FPRICE
rs_DataRow(5) = sCIR(idx).FAMOUNT
rs_DataRow(6) = sCIR(idx).FMARGIN_PERCENT
rs_DataRow(7) = sCIR(idx).FMARGIN_PROFIT
'Add up the total cost value
m_totalCost += sCIR(idx).FCOST * sCIR(idx).FSHIPQTY
'Add up the total price value
m_totalPrice += sCIR(idx).FPRICE * sCIR(idx).FSHIPQTY
'Calculate the average margin of all the items
'm_avgMarkup +=
'Add up the total margin value
m_totalMargin += sCIR(idx).FMARGIN_PROFIT
rs_Table.Rows.Add(rs_DataRow)
Next
End If
|
|
|
|
|
It just sounds like you need the information about how many items are sold and at what price; then the math is pretty straight forward.
(The sum of all (Item*Price))/Total numbers of items
PS. You are not looking for the weighted sum, unless you don't know how many items are sold. But then your math can't be done.
|
|
|
|
|
Hi, you can get the average by doing this:
m_avgMarkup += sCIR(idx).FMARGIN_PERCENT /idx
below is the whole code,
If (sCIR.Length > 0) Then
For idx As Integer = 0 To sCIR.Length - 1
rs_DataRow = rs_Table.NewRow()
rs_DataRow(0) = sCIR(idx).FITEMNO
rs_DataRow(1) = sCIR(idx).FDESCRIPT
rs_DataRow(2) = sCIR(idx).FSHIPQTY
rs_DataRow(3) = sCIR(idx).FCOST
rs_DataRow(4) = sCIR(idx).FPRICE
rs_DataRow(5) = sCIR(idx).FAMOUNT
rs_DataRow(6) = sCIR(idx).FMARGIN_PERCENT
rs_DataRow(7) = sCIR(idx).FMARGIN_PROFIT
'Add up the total cost value
m_totalCost += sCIR(idx).FCOST * sCIR(idx).FSHIPQTY
'Add up the total price value
m_totalPrice += sCIR(idx).FPRICE * sCIR(idx).FSHIPQTY
'Calculate the average margin of all the items
'm_avgMarkup += sCIR(idx).FMARGIN_PERCENT /idx
'Add up the total margin value
m_totalMargin += sCIR(idx).FMARGIN_PROFIT
rs_Table.Rows.Add(rs_DataRow)
Next
End If
hi
|
|
|
|
|
That's a point in the right direction.
I'll try something similar to that.
If (sCIR.Length > 0) Then
Dim idx As Integer = 0
For idx = 0 To sCIR.Length - 1
rs_DataRow = rs_Table.NewRow()
rs_DataRow(0) = sCIR(idx).FITEMNO
rs_DataRow(1) = sCIR(idx).FDESCRIPT
rs_DataRow(2) = sCIR(idx).FSHIPQTY
rs_DataRow(3) = sCIR(idx).FCOST
rs_DataRow(4) = sCIR(idx).FPRICE
rs_DataRow(5) = sCIR(idx).FAMOUNT
rs_DataRow(6) = sCIR(idx).FMARGIN_PERCENT
rs_DataRow(7) = sCIR(idx).FMARGIN_PROFIT
'Add up the total cost value
m_totalCost += sCIR(idx).FCOST * sCIR(idx).FSHIPQTY
'Add up the total price value
m_totalPrice += sCIR(idx).FPRICE * sCIR(idx).FSHIPQTY
'Calculate the average margin of all the items
m_avgMarkup += sCIR(idx).FMARGIN_PERCENT
'Add up the total margin value
m_totalMargin += sCIR(idx).FMARGIN_PROFIT
rs_Table.Rows.Add(rs_DataRow)
Next
m_avgMarkup = m_avgMarkup / idx
End If
|
|
|
|
|
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
|
|
|
|
|
I have applied following css to dropdownlist.In chrome browser applied css are reflecting but in mozilla css are not reflecting. I also want to do text of dropdownlist in center align so how to do this? Please anyone guide me?
css are as follows..
border-color:blue;
border-width:2px;
border-top-left-radius:10px;
border-top-right-radius:10px;
border-bottom-left-radius:10px;
border-bottom-right-radius:10px;
-moz-border-radius-bottomleft:10px;
-moz-border-radius-bottomright:10px;
-moz-border-radius-topleft:10px;
-moz-border-radius-topright:10px;
-moz-border-radius:10px;
-webkit-box-align:center;
text-align:center;
|
|
|
|
|
|
|
Hi all,
I have a question regarding hiding of a label and a textbox on a page based on AD group membership (I only want members of the AD group to view and use the ASP control)
So I have the following within my Page_Load Sub
Dim ITContactLabel As Label = DirectCast(FormView1.FindControl("ITContactLabel"), Label)
Dim ITContactTextBox As TextBox = DirectCast(FormView1.FindControl("PRJ_ITContactTextBox"), TextBox)
If (User.IsInRole("MyDomain\My_AD_Group_X") <> "true") Then
' hide the ITContact label
ITContactLabel.Style("visibility") = "hidden"
ITContactTextBox.Visible = "false"
End If
And it works fine when the page is first loaded, but after I hit the update link, the label and textbox become visible.
I have tried to define an OnClick event in my code, but not having success hiding the label and textbox:
Protected Sub UpdateButton_Click(sender As Object, e As System.EventArgs)
in html:
<asp:linkbutton id="UpdateButton" runat="server" causesvalidation="True" onclick="UpdateButton_Click" commandname="Update" text="Update">
I'm thinking it may have something to do with checking the AD group membership, but not sure, any help would be appreciated.
|
|
|
|
|
Try moving that code to FormView1.DataBound Event. If it does not solve your issue post your entire page_load function and your UpdateButton_OnClick event.
|
|
|
|
|
this is all of my code behind:
Partial Class MyPage
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
hiddenID.Value = Convert.ToInt16(Request.QueryString("id"))
Dim LoginLabel As Label = DirectCast(FormView1.FindControl("CurrentUserLogin"), Label)
LoginLabel.Text = HttpContext.Current.User.Identity.Name
If (User.IsInRole("MYDOMAIN\MyADGroup1") <> "true") Then
Response.Redirect("~/AccessDenied.aspx")
End If
Dim ITContactLabel As Label = DirectCast(FormView1.FindControl("ITContactLabel"), Label)
Dim ITContactTextBox As TextBox = DirectCast(FormView1.FindControl("PRJ_ITContactTextBox"), TextBox)
If (User.IsInRole("MYDOMAIN\MyADGroup_X") <> "true") Then
' hide the ITContact label
ITContactLabel.Style("visibility") = "hidden"
ITContactTextBox.Visible = "false"
End If
End Sub
Protected Sub UpdateButton_Click(sender As Object, e As System.EventArgs)
Dim ITContactLabel As Label = DirectCast(FormView1.FindControl("ITContactLabel"), Label)
Dim ITContactTextBox As TextBox = DirectCast(FormView1.FindControl("PRJ_ITContactTextBox"), TextBox)
If (User.IsInRole("MYDOMAIN\MyADGroup_X") <> "true") Then
ITContactLabel.Style("visibility") = "hidden"
ITContactTextBox.Visible = "false"
End If
End Sub
End Class
|
|
|
|
|
Debug the code. Put a breakpoint in your Page_Load and see what is happening. You may have your code inside of a check for IsPostBack and so it only runs the one time.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi,
I was able to solve my issue.
string value = DataBinder.Eval(e.Row.DataItem, "SAPLeader").ToString();
dd.SelectedValue = value;
dd.SelectedIndex = dd.Items.IndexOf(dd.Items.FindByText(value.ToString()));
This is the fixed.
modified 29-Jul-15 13:55pm.
|
|
|
|
|
dd.Text? Shouldn't you use dd.SelectedValue or dd.SelectedItem?
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
I changed it to dd.SelectedValue = value;
It still doesn't work. The issue is that once I select EDIT the current value in the SAPLeader field goes away and the dropdownlist is now showing the first value and that is the one it choses when you select UPDATE. What I would like it do is to select the right dropdown value when the dropdownlist loads.
|
|
|
|
|
try something LIKE:
ddlData.SelectedIndex=ddlData.Items.IndexOf(ddlData.Items.FindByText("value"));
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Automatically send emails at specific date time using asp.net
|
|
|
|
|
You will need to create a Windows service to send out your scheduled emails or task the windows service to call a page from you website that will trigger the sending.
|
|
|
|
|
|
Scott Hanselman has several suggestions for you:
How to run Background Tasks in ASP.NET[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Nice link. Helps me even out!
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
I have Using DevExpress Version 12 I have problem on ASPxGridview on Row selection in Keyboard Up-Down KeyBoard.I Have Set Property "KeyBoardSupport" is "True" It Display On Page load ASPxGridView First row Selected with BackColor is Black.I want first Row Is Select On Mouse Click Then Keyboard Up-Down Arrow Key Row Selction Changed.How?
|
|
|
|
|