Click here to Skip to main content
15,887,898 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionIsPostBack Pin
Member 1116162527-Sep-15 19:26
Member 1116162527-Sep-15 19:26 
AnswerRe: IsPostBack Pin
Richard MacCutchan27-Sep-15 21:44
mveRichard MacCutchan27-Sep-15 21:44 
AnswerRe: IsPostBack Pin
PANKAJMAURYA27-Sep-15 22:00
professionalPANKAJMAURYA27-Sep-15 22:00 
AnswerRe: IsPostBack Pin
deepankarbhatnagar30-Sep-15 2:39
professionaldeepankarbhatnagar30-Sep-15 2:39 
AnswerRe: IsPostBack Pin
sridhar_thota7-Oct-15 21:16
sridhar_thota7-Oct-15 21:16 
QuestionHtmlTextWriter vs HtmlTable.RenderControl Pin
dashing_inn200323-Sep-15 17:57
professionaldashing_inn200323-Sep-15 17:57 
AnswerRe: HtmlTextWriter vs HtmlTable.RenderControl Pin
Richard MacCutchan23-Sep-15 21:45
mveRichard MacCutchan23-Sep-15 21:45 
QuestionHow to display results based on employees manager and department Pin
samflex22-Sep-15 17:23
samflex22-Sep-15 17:23 
Dear experts,

I do really appreciate your highly valued expertise.

I am trying to think up a solution but I am frozen.

First we have two tables ( I didn't design it in case it is flawed), Emp table and Angulers table.

The emp table contains the following fields:

EmpID,

EmpName

Password

Dept

And several others but those above are the relevant ones.

Then Angulers table with following relevant fieldnames:

EmpID - Foreign Key to Emp table

ManagerID -related to EmpID on Emp table

Status (Status has a value of Pending or Done)

The history:

The process is that employees will log in first to register their grievances and suggest a remedy.

Once an employee is done and clicks the Done button, next time that employee logs in, that employee is no longer allowed to make any changes.

By the way, employees log in with empID as username and Password as password.

This works fine.

Now that that employee is done, his or her manager then logs in to a page called EmployeeSummary.aspx to view a list of his/her employees.

Each manager can view his/her employee based on his/her ID and the department that s/he and his/her employees belong to.

This is where I am having problem.

How do I make a manager log into EmployeeSummary.aspx page and only see those employees that are in his/her department?

Here is the code I am working with but it is coming blank when I run it.


PHP
<div align="center">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" AllowPaging="true"
        OnPageIndexChanging="OnPageIndexChanging" PageSize="10">
        <Columns>
             <asp:HyperLinkField DataNavigateUrlFields="ManagerID,department"
                DataNavigateUrlFormatString="employeeDetails.aspx?ID={0}&Dept={1}" Text="Add Comments" />
            <asp:BoundField ItemStyle-Width="200px" DataField="empname" HeaderText="Employee Name" />
            <asp:BoundField ItemStyle-Width="250px" DataField="department" HeaderText="Department" />
         </Columns>
    </asp:GridView>
</div>


--Code Behind:
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Not Me.IsPostBack Then
            Me.BindGrid()
        End If
    End Sub

    Private Sub BindGrid()
        Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
        Using con As New SqlConnection(constr)
            Using cmd As New SqlCommand("SELECT e.empID, e.empname, e.department, a.managerID, a.status FROM Emp e INNER JOIN Angulers a ON a.empID = e.empID WHERE a.status = 'Done' and e.ManagerID = '"&querystring("ID") & "' and e.department = '"&uerystring("dept") & "' ")
                'We use parametized query to prevent sql injection attack
                '  Dim p1 As New SqlParameter("@dept", Session("dept"))
                'cmd.Parameters.Add(p1)
                Using sda As New SqlDataAdapter()
                    cmd.Connection = con
                    sda.SelectCommand = cmd
                    Using dt As New DataTable()
                        sda.Fill(dt)
                        GridView1.DataSource = dt
                        GridView1.DataBind()
                    End Using
                End Using
            End Using
        End Using
    End Sub

    Protected Sub OnPageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
        GridView1.PageIndex = e.NewPageIndex
        Me.BindGrid()
End Sub


Thank you in advance
AnswerRe: How to display results based on employees manager and department Pin
Herman<T>.Instance23-Sep-15 0:24
Herman<T>.Instance23-Sep-15 0:24 
SuggestionRe: How to display results based on employees manager and department Pin
Richard Deeming23-Sep-15 1:55
mveRichard Deeming23-Sep-15 1:55 
GeneralRe: How to display results based on employees manager and department Pin
samflex23-Sep-15 2:37
samflex23-Sep-15 2:37 
AnswerRe: How to display results based on employees manager and department Pin
F-ES Sitecore23-Sep-15 5:56
professionalF-ES Sitecore23-Sep-15 5:56 
GeneralRe: How to display results based on employees manager and department Pin
samflex23-Sep-15 17:36
samflex23-Sep-15 17:36 
GeneralRe: How to display results based on employees manager and department Pin
F-ES Sitecore23-Sep-15 21:57
professionalF-ES Sitecore23-Sep-15 21:57 
GeneralRe: How to display results based on employees manager and department Pin
samflex24-Sep-15 3:42
samflex24-Sep-15 3:42 
GeneralRe: How to display results based on employees manager and department Pin
F-ES Sitecore24-Sep-15 3:48
professionalF-ES Sitecore24-Sep-15 3:48 
QuestionHow to open javasript pop on button click Pin
Member 1200294722-Sep-15 1:34
Member 1200294722-Sep-15 1:34 
AnswerRe: How to open javasript pop on button click Pin
JHizzle22-Sep-15 2:47
JHizzle22-Sep-15 2:47 
AnswerRe: How to open javasript pop on button click Pin
F-ES Sitecore22-Sep-15 7:17
professionalF-ES Sitecore22-Sep-15 7:17 
QuestionAspdotnet webservice using in HTML with Javascript Pin
J.Ramanjaneyulu21-Sep-15 4:17
J.Ramanjaneyulu21-Sep-15 4:17 
AnswerRe: Aspdotnet webservice using in HTML with Javascript Pin
Richard MacCutchan21-Sep-15 5:20
mveRichard MacCutchan21-Sep-15 5:20 
AnswerRe: Aspdotnet webservice using in HTML with Javascript Pin
Blikkies21-Sep-15 19:52
professionalBlikkies21-Sep-15 19:52 
GeneralRe: Aspdotnet webservice using in HTML with Javascript Pin
J.Ramanjaneyulu28-Sep-15 15:42
J.Ramanjaneyulu28-Sep-15 15:42 
QuestionRe: Aspdotnet webservice using in HTML with Javascript Pin
Blikkies28-Sep-15 19:37
professionalBlikkies28-Sep-15 19:37 
QuestionHelp .aspx/ going to another page Pin
Member 1199854620-Sep-15 14:44
Member 1199854620-Sep-15 14:44 

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.