1

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..

<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

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 pic

and in .aspx i set like this

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

STORE PROCEDURE EDITED...

ALTER procedure [dbo].[UserIDDoc]

@UserID int
as
Select DISTINCT 
   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 ,
dbo.DocumentInfo.ViewedID

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.viwed on dbo.DocumentInfo.ViewedID=dbo.Viwed.ViewedType

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

pic

in approvetype table it look like this in my db

ApproveID   ApproveType 
1           Approve 
2           Reject  
3           Pending 
user3134694
  • 75
  • 2
  • 3
  • 16

1 Answers1

0

If you have a way to know if a document has been read or if there is an "Opened" flag in your database then it is all a matter of CSS. Do something like

<ItemTemplate>
   <tr class="<%# DataBinder.Eval(Container.DataItem, "ReadFlag") == "1" ? "highlight" : string.Empty />">

Let me know if you have any doubts.

Alok
  • 1,290
  • 1
  • 11
  • 21
  • what is opened flag in database? – user3134694 Jan 23 '14 at 04:21
  • this shows me error when i try ur answer...ERROR "DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ReadFlag'." – user3134694 Jan 23 '14 at 08:14
  • Dude, "ReadFlag" is something you need to create. That flag will distinguish wether the document has been opened or not. – Alok Jan 23 '14 at 08:29
  • ok when i create a ues/no column in table then how to set in vs08? – user3134694 Jan 23 '14 at 13:55
  • You use the code above to highlight it. Call the flag to check if the document has been read or not. If it is false then highlight it or else do not. – Alok Feb 04 '14 at 14:09
  • What are you not getting there? It is a database item. You check if it is true or false. If it is true then you highlight it. on the add a class as I have in my answer, to highlight the row – Alok Feb 04 '14 at 14:17
  • OK. Add false as your default input in SP. Set it to true once the user has checked the document. like : insert into DocumentInfo(DocDesciption,DocName,UploadedDate,Uploadfile,DocTypeID,DepID,UploadedBy,ApproveID,UserID, yes_no ) values(@DocDesciption,@DocName,GETDATE(),@Uploadfile,@DocTypeID,@DepID,@UploadedBy,3,@UserID, 'false' ) – Alok Feb 04 '14 at 15:05
  • Although, I must admit, yes_no is really a bad name as it means nothing really other than the field is boolean. Name it to something like "Viewed" or "Checked". Just make sure it is "false" to start with. – Alok Feb 04 '14 at 15:07
  • In your select statement you have not got Viewed !! Try adding it after dbo.ApproveType.ApproveType AS Status: like dbo.ApproveType.ApproveType, dbo.ApproveType.Viewed.. I hope it works after that. – Alok Feb 05 '14 at 17:14
  • plesae check my update question and listen please in approvetype there is not true ,false condition .... there is approve,pedning,and reject in table – user3134694 Feb 05 '14 at 18:20
  • and i dont understand why u write dbo.ApproveType.Viewed – user3134694 Feb 05 '14 at 18:20
  • Sorry. It should be dbo.DocumentInfo.Viewed – Alok Feb 06 '14 at 10:17
  • hey when i upload new document it not become bold or highlight....and please check my update question – user3134694 Feb 06 '14 at 12:15