0
Answer

Number of download files count

Thulasiram pakala

Thulasiram pakala

12y
1.9k
1
hi please help for my quistion

hi i am using datalist control inside  taking lable control and link button in update panel i put image control and progress bar when  click download link i want to need no files count of downloads display in to the view link  am usng select statement in count files i click and download file it will shows count but i am upload another file it will also shows that above number of views same but  i am not download that file and also after finesh download the progress bar sprit image was not hide.
 


        so i want to need download different files count in proper and after down load finesh the sprit image close.


please give answer this
                          


 

 <asp:DataList runat="server" ID="dlFiles" onitemdatabound="dlFiles_databound" CssClass="clslistitems" >
                                            <ItemTemplate>
                                            <asp:HiddenField runat="server" ID="hdfDocId" Value='<%#Eval("FileID") %>'></asp:HiddenField>
                                             <asp:HiddenField runat="server" ID="hdffilePath" Value='<%#Eval("FilePath") %>'></asp:HiddenField>
                                             <asp:Label runat="server" ID="myTest" cssclass="anothertest" style="display:none;" Text='<%#Eval("FilePath") %>'></asp:Label>
                                            <table>
                                            <tr>
                                            <td  colspan="3">
                                                <asp:Image ID="imgFileType" runat="server"  height="23px" width="23px"
                                               
                                                    />
                                                </td>
                                            <td>
                                            <asp:LinkButton runat="server" ID="lnkFile" Text='<%#Eval("File") %>'  onclick="btnDownloadFile_Click"  ></asp:LinkButton>
                                           
                                            </td>
                                            <td style="padding-left:15px;">
                                             <asp:LinkButton runat="server" ID="lnkFileViews" cssclass="clsViews"  Text='<%#Eval("TotalViews") %>'   ></asp:LinkButton>
                                           
                                            </td>
                                            </tr>
                                           
                                            </table>
                                            </ItemTemplate>
                                        </asp:DataList>
                                        </ContentTemplate>
                                                                                 
                                          </asp:UpdatePanel>



.cs file
                lnkfileviews.Attributes.Add("onclick", "ShowReport('" + lnkfileviews.ClientID + "','" + DataBinder.Eval(e.Item.DataItem, "FileID").ToString() + "')");

                lnkFile.Attributes.Add("onclick", "PerformCallback('" + DataBinder.Eval((e.Item.NamingContainer.NamingContainer as GridViewRow).DataItem, "membersonly").ToString() + "')");

                string filename = DataBinder.Eval(e.Item.DataItem, "File").ToString();
                string extension = Path.GetExtension(filename);
                Image imgfiletype = (Image)(e.Item.FindControl("imgFileType"));
                if (extension == ".jpg" || extension == ".jpeg" || extension == ".png" || extension == ".gif" || extension == ".bmp")
                {
                    imgfiletype.ImageUrl = "Styles/Images/image_icon.png";
                }
                else if (extension == ".txt")
                {
                    imgfiletype.ImageUrl = "Styles/Images/txt_icon.png";
                }

                else if (extension == ".doc" || extension == ".docx" || extension == ".rtf")
                {
                    imgfiletype.ImageUrl = "Styles/Images/word_icon.png";
                }
                else if (extension == ".pptx" || extension == ".ppt" || extension == ".pptm" || extension == ".ppsx")
                {
                    imgfiletype.ImageUrl = "Styles/Images/ppt_icon.png";
                }
                else if (extension == ".xls" || extension == ".xlsx" || extension == ".xlsm" || extension == ".xlstx")
                {
                    imgfiletype.ImageUrl = "Styles/Images/excel_icon.png";
                }
                else if (extension == ".pdf" || extension == ".psd")
                {
                    imgfiletype.ImageUrl = "Styles/Images/pdf_icon.png";
                }
                else
                {
                    imgfiletype.ImageUrl = "Styles/Images/unknown_icon.png";
                }

            }


thanks