Click here to Skip to main content
15,905,427 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
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>

any help please?
Posted
Updated 22-Jan-14 21:20pm
v2
Comments
Karthik_Mahalingam 23-Jan-14 3:21am    
which method you r using to create a new document ??
Diya Ayesa 23-Jan-14 8:53am    
insert

you can set some flag for that. when a new record entered the flag will be on. when user open that document that flag will be off. based on that flag you can check whether that doc is read/unread by the user.

and also using that flag you can change the css in side the repeater also..
you can chekc that flag from repeater data bound event,

hope this will help you.
 
Share this answer
 
Comments
Diya Ayesa 23-Jan-14 8:53am    
thanks for ur reply and how to create that flag?
ravikhoda 23-Jan-14 22:55pm    
you can add a column in the database with bit datatype. by default that would be false. once it is read it will be true.
Diya Ayesa 24-Jan-14 5:50am    
ok i add clumn now how i set in vs?
Try something like this


<asp:repeater id="Repeater1" runat="server" datasourceid="SqlDataSource1" onitemdatabound="Repeater1_ItemDataBound" xmlns:asp="#unknown">
<itemtemplate>
<asp:label id="Label1" runat="server" text="<%# Eval(" name")="" %&gt;"="">




protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
       {
           if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
           {
               DataRowView drv = (DataRowView)e.Item.DataItem;
               if (drv["tid"].ToString() == "1")
               {
                   Label lbl = e.Item.FindControl("Label1") as Label;
                   lbl.Font.Bold = true;
               }
           }
       }
 
Share this answer
 
Comments
Diya Ayesa 24-Jan-14 8:12am    
what is "tid" in code AND Sqldatasource1 in repeater
Diya Ayesa 27-Jan-14 5:27am    
@ravikhoda can u please tell me ?
ravikhoda 27-Jan-14 5:55am    
well this is just a sample code, you can change it with your column name ...

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