How do I filter GridView to show data that does not belong to me based on condition?
For example.
I have this table
Id
|
Email
|
name
|
CreatedBy
|
1
|
richard@gmail.com
|
Richard Samuel
|
richard@gmail.com
|
2
|
donald24@yahoo.com
|
Donald Symmons
|
donald24@yahoo.com
|
3
|
jennyp@gmail.com
|
Jennifer Peters
|
richard@gmail.com
|
4
|
unicaf.edu@gmail.com
|
University of PH
|
unicaf.edu@gmail.com
|
5
|
preston@gmail.com
|
Preston Udo
|
unicaf.edu@gmail.com
|
6
|
jaywon001@yahoo.co.uk
|
Josh King
|
richard@gmail.com
|
7
|
williamsp@gmil.com
|
Williams Akpan
|
unicaf.edu@gmail.com
|
From the above table, the email richard@gmail.com has two other users associated with it. How can I hide every data or record that is associated with richard@gmail.com?
Is this possible?
Here is my HTML, stored procedure
<asp:GridView ID="GridView1" runat="server" GridLines="None" AllowPaging="true" HeaderStyle-ForeColor="#224f6d" HeaderStyle-Font-Size="11pt" RowStyle-Font-Size="10pt"
AutoGenerateColumns="false" DataKeyNames="Uid" PageSize="7" CssClass="table" Width="100%" HeaderStyle-HorizontalAlign="left" RowStyle-HorizontalAlign="Left">
<EmptyDataTemplate>
<div style="text-align: center; font-weight: 500; font-size: medium;">
<asp:Label ID="labelTemp" runat="server" Text="No Data"></asp:Label>
</div>
</EmptyDataTemplate>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="email" HeaderText="Email" HeaderStyle-Font-Bold="false" />
<asp:BoundField DataField="name" HeaderText="Name" ReadOnly="true" HeaderStyle-Font-Bold="false" />
</Columns>
</asp:GridView>
CREATE PROCEDURE [dbo].[UserData]
@CreatedBy VARCHAR(50)
,@PageIndex INT
,@PageSize INT
,@RecordCount INT OUT
AS
BEGIN
SELECT ROW_NUMBER() OVER(ORDER BY email) RowNumber
,Name
,email
,email
,name
,CreatedBy
INTO #Temp
FROM Users
SELECT @RecordCount = COUNT(*) FROM #Temp
SELECT * FROM #Temp
WHERE (RowNumber BETWEEN ((@PageIndex-1) * @PageSize) + 1 AND (@PageIndex * @PageSize)) OR @PageIndex = - 1
DROP TABLE #Temp
END
RETURN 0