Click here to Skip to main content
15,904,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i use repeater in my project .. so when user add new document then i want to highlight new add documents same as gmail when we see new email in gmail account then email is in bold and then we able to see someone send email same as i want when new record added then how to highlight or identify in other ways? this is repeater code..

ASP.NET
<table class="CSSTableGenerator" border="0" cellpadding="0" cellspacing="0" id="results">
    <asp:Repeater ID="Repeater2" OnItemCommand="Repeater2_ItemCommand" runat="server"
        OnItemDataBound="Repeater2_ItemDataBound">
        <HeaderTemplate>
            <tr>
                <%-- <td>
                                   DocumentID
                                </td>--%>
                <td>
                    Document Name
                </td>
                <td>
                    File Name
                </td>
                <td>
                    Uploaded By
                </td>
                <td>
                    Uploaded Date
                </td>
                <td>
                    Email
                </td>
                <td>
                    Department
                </td>
                <td>
                    Status
                </td>
            </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <asp:HiddenField ID="DocId" runat="server" Value='<%#DataBinder.Eval(Container.DataItem, "DocID")%>' />
                <%--<asp:Label Id="DocId" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "DocID")%>'></asp:Label>--%>
                <td>
                    <asp:Label ID="DocName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "DocumentName")%>'></asp:Label>
                </td>
                <td>
                    <asp:Label ID="Uploadfile" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Uploadfile")%>'></asp:Label>
                </td>
                <td>
                    <asp:Label ID="Label1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "UploadedBy")%>'></asp:Label>
                </td>
                <td>
                    <asp:Label ID="UploadedDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "UploadedDate")%>'></asp:Label>
                </td>
                <td>
                    <asp:Label ID="YourEamil" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "UserEmail")%>'></asp:Label>
                </td>
                <td>
                    <asp:Label ID="DepType" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Department")%>'></asp:Label>
                </td>
                <td>
                    <asp:Label ID="lblCountry" runat="server" Text='<%# Eval("ApproveID") %>' Visible="false" />
                    <asp:HiddenField ID="hfDepartmentId" runat="server" Value='<%# Eval("ApproveID") %>' />
                    <asp:DropDownList ID="DropDownList4" runat="server" EnableViewState="true" class="vpb_dropdown1"
                        DataTextField="ApproveType" DataValueField="ApproveID" AutoPostBack="true" OnSelectedIndexChanged="DropDownList4_SelectedIndexChanged">
                        <asp:ListItem Text="Pending" Selected="selected" Value="3"></asp:ListItem>
                        <asp:ListItem Text="Approve" Value="1"></asp:ListItem>
                        <asp:ListItem Text="Reject" Value="2"></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
        </ItemTemplate>
    </asp:Repeater>
</table>


and this is the sp when user upload document

SQL
ALTER procedure [dbo].[fileupload]
@DocDesciption nvarchar(50),
@DocName nvarchar(50),
@Uploadfile nvarchar(50),
@DocTypeID int,
@DepID int,

@UploadedBy nvarchar(50),
@UserID int
as
insert into DocumentInfo(DocDesciption,DocName,UploadedDate,Uploadfile,DocTypeID,DepID,UploadedBy,ApproveID,UserID,Viewed )
values(@DocDesciption,@DocName,GETDATE(),@Uploadfile,@DocTypeID,@DepID,@UploadedBy,3,@UserID,'false')


ok when i upload new document and in table it shows me like this please check this pic table
TABLE PIC[^]


and in .aspx i set like this

<tr class="<%# DataBinder.Eval(Container.DataItem, "Viewed") == "false" ? "highlight" : string.Empty %>">

there is .aspx upload document form and another view document form in .aspx uplaod document form user upload document in this form and his/her document view in .aspx view-document form

for view document i use this sp

SQL
ALTER procedure [dbo].[UserIDDoc]

@UserID int
as
Select DISTINCT dbo.DocumentInfo.Viewed, dbo.DocumentInfo.DocID as DocumentID,
dbo.DocumentInfo.DocName as DocumentName,
dbo.DocumentInfo.UploadedDate as UploadedDate, dbo.DocType.DocType as Document,

dbo.Department.DepType as Department, dbo.DocumentInfo.Uploadfile as FileUploaded,

dbo.ApproveType.ApproveType AS Status

FROM dbo.DocumentInfo inner JOIN dbo.DocType ON dbo.DocumentInfo.DocTypeID=dbo.DocType.DocTypeID
inner JOIN dbo.Department ON dbo.DocumentInfo.DepID=dbo.Department.DepID

inner join dbo.ApproveType on dbo.DocumentInfo.ApproveID=dbo.ApproveType.ApproveID
left JOIN dbo.Approval ON dbo.DocumentInfo.DocID = dbo.Approval.DocID
where UserID=@UserID


but when i view document then documents not in bold or highlight check this pic

REPEATER PIC
REPEATER PIC[^]
Posted
Comments
sri senthil kumar 5-Feb-14 4:31am    
one suggestion would be, add a new column to the "datasource" your binding to the repeater saying "isNew" and append values like new/old.

Append this column to the tr's class=<> ... done in css write style for it. hope it helps
Diya Ayesa 5-Feb-14 5:03am    
i already add column please check pic
sri senthil kumar 5-Feb-14 5:09am    
can u post the style how u have written? also have you checked whether the highlight class is added to tr?
Diya Ayesa 5-Feb-14 7:32am    
whihc style class? u means csstablegenerator or something else?
sri senthil kumar 5-Feb-14 7:38am    
<tr class="<%# DataBinder.Eval(Container.DataItem, "Viewed") == "false" ? "highlight" : string.Empty %>">

highlight class u have added in the above tr

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900