Home > DeveloperSection > Forums > Based on logged username to filter data in Gridview
Munikumar G

Total Post:9

Points:63
Posted on    February-15-2012 8:01 AM

 ASP.Net ASP.Net 
Ratings:


 4 Reply(s)
 4347  View(s)
Rate this:
Post is removed by the User.


Awadhendra Tiwari

Total Post:126

Points:882
Posted on    February-15-2012 8:38 AM

Hi,         

  In gridview display data as login username.

Thanks

 

MuniKumar,

What you trying to ask?
 You can paste you code here.

Here I am providing some links related with datagridview in asp.net which might be useful for you.

1.       http://mindstick.com/Articles/0efe2da6-407e-4442-a675-475bd6f8a2d7/?GridView%20Decoration%20in%20ASP.Net

2.       http://mindstick.com/Articles/2552ee5c-add6-435d-87ae-57abf42b23be/?GridView%20inside%20GridView%20in%20ASP.Net%20%28Nested%20GridView%29

3.       http://mindstick.com/Articles/72e6f660-f985-4470-99d6-81f472882868/

Thanks


Munikumar G

Total Post:9

Points:63
Posted on    February-17-2012 5:53 AM

Post is removed by the User.

Munikumar G

Total Post:9

Points:63
Posted on    February-24-2012 6:59 AM

Hi,

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

<Columns>

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

</Columns>

<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:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MarketingSheetConnectionString %>"

SelectCommand="SELECT*FROM [Appointment]" ></asp:SqlDataSource>

Thanks


Chris Anderson
Chris Anderson

Total Post:65

Points:455
Posted on    February-25-2012 12:35 AM

hi,

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)">
            <SelectParameters>
                <asp:SessionParameter DefaultValue="" Name="id" SessionField="clientID"
                    Type="Int32" />
            </SelectParameters>
</asp:SqlDataSource>

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.

Thanks.

Don't want to miss updates? Please click the below button!

Follow MindStick