Based on logged username to filter data in Gridview

Total Post:9


 7619  View(s)
Rate this:
Post is removed by the User.
  1.   Modified On Mar-29-2018 05:05:51 AM
  1. Re: Based on logged username to filter data in Gridview

    Post is removed by the User.

  1. Re: Based on logged username to filter data in Gridview


    This is my code

    who has to login in the site display user details only on gridview.  

    please send me the code asap.

    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
    AutoGenerateColumns="False" DataKeyNames="ApptId" DataSourceID="SqlDataSource1"
    CellPadding="4" ForeColor="#333333" GridLines="None" AllowSorting="True">
    <AlternatingRowStyle BackColor="White" />
    <asp:BoundField DataField="ClientId" HeaderText="ClientName"
    SortExpression="ClientId" />
    <asp:BoundField DataField="UserId" HeaderText="UserName"
    SortExpression="UserId" />
    <asp:BoundField DataField="ApptTime" HeaderText="ApptTime"
    SortExpression="ApptTime" />
    <asp:BoundField DataField="ApptDate" HeaderText="ApptDate"
    SortExpression="ApptDate" />
    <asp:BoundField DataField="Duration" HeaderText="Duration"
    SortExpression="Duration" />
    <asp:BoundField DataField="MOM" HeaderText="MOM" SortExpression="MOM" />
    <asp:BoundField DataField="SalesExecutiveObjects"
    HeaderText="SalesExecutiveObjects" SortExpression="SalesExecutiveObjects" />
    <asp:BoundField DataField="SalesProjection" HeaderText="SalesProjection"
    SortExpression="SalesProjection" />
    <asp:BoundField DataField="NextFollowUpDate" HeaderText="NextFollowUpDate"
    SortExpression="NextFollowUpDate" />
    <asp:BoundField DataField="ExecutedClosingDate"
    HeaderText="ExecutedClosingDate" SortExpression="ExecutedClosingDate" />
    <asp:BoundField DataField="Remarks" HeaderText="Remarks"
    SortExpression="Remarks" />
    <asp:BoundField DataField="StatusId" HeaderText="StatusName"
    SortExpression="StatusId" />
    <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
    <SortedAscendingCellStyle BackColor="#FDF5AC" />
    <SortedAscendingHeaderStyle BackColor="#4D0000" />
    <SortedDescendingCellStyle BackColor="#FCF6C0" />
    <SortedDescendingHeaderStyle BackColor="#820000" />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MarketingSheetConnectionString %>"
    SelectCommand="SELECT*FROM [Appointment]" ></asp:SqlDataSource>

      Modified On Mar-29-2018 05:04:55 AM
  1. Re: Based on logged username to filter data in Gridview


    If you want to display data of logged in user, you have to create the following sql query:

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:workbookConnectionString %>"
                SelectCommand="SELECT * FROM [clientDetails] WHERE ([id] = @id)">
                    <asp:SessionParameter DefaultValue="" Name="id" SessionField="clientID"
                        Type="Int32" />

    In the above query a session field is created (id) in which you have to pass the id of user in order to display data in gridview.


      Modified On Mar-29-2018 05:05:13 AM


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.