Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 21st, 2006, 12:35 AM
Authorized User
 
Join Date: Nov 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to akhilhp
Default Opening and/or Editing Document file in ASP.NET 2.

Dear All,

I am new to ASP.Net 2.0(or say to asp.net itself) I have been recently assigned a project. In this subordinate staff will prepare reports for recieved applications from the public and the officer will take decision depending upon the report submitted for a particular application. For report writing we are planning to use the MS-Word. I have been able to store the MS Word Document to the database through ASP.NET 2.0. Now I am stuck for how can I open the stored document for the Officer. In simple way I want to open a word document from a web page created using ASP.NET 2.0. Can anybody help me.
 
Old December 21st, 2006, 03:24 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

How do you plan on accessing the file?


 
Old December 22nd, 2006, 12:42 AM
Authorized User
 
Join Date: Nov 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to akhilhp
Default

I wish that there can be a button on the page for "View Report" and when the officer clicks it the report document should open (as the report presently being uploaded is in Word format so the report should open in the Word)

But I am not rigid in it. I simply want that there should be some criteria in which the subordinate staff can write and save report corresponding to an application and the officer should be able to view this report when he wants to make a decision on the application. I previously used the text field in SQL Table and allowed to enter the report in textbox, which then was saved to the text field of the table. While making decision the report was shown in a label taking the report from the text field of the table. But my Group head rejected this design. He is insisting that the report should be allowed to be written in a document editor.
 
Old December 27th, 2006, 02:13 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

If you have a grid view bound to your database, you can add a hyperlink field which is bound to the table field which holds the path and file name. When clicked they can open the file, edit and save it.



 
Old January 3rd, 2007, 02:23 AM
Authorized User
 
Join Date: Nov 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to akhilhp
Default

It did not work dear. As the User will be updating new documents every day. Also since the documents are being uploaded from client side the file path and name cannot be sent to the table field. I tried to get the file from table and save it on server and give the hyperlink that address but it again didnot work. I am using following procedure :
            Con = New SqlConnection(MainConStr)
            SQLStr = "Select ruid, report, 'File Name' as reportnm from case_initial where court_cd = 'C001'"
            Dim b, i As Integer
            Dim sqladp As New SqlDataAdapter(SQLStr, Con)
            Dim ds As New DataSet
            b = sqladp.Fill(ds, "Try")
            Dim MyData() As Byte
            Dim fs As FileStream
            For i = 0 To ds.Tables("Try").Rows.Count - 1
                If Not IsDBNull(ds.Tables("Try").Rows(i).Item(1)) Then
                    MyData = ds.Tables("Try").Rows(i).Item(1)
                    Dim k As Long
                    k = UBound(MyData)
                    fs = New FileStream(Server.MapPath(".\Created" & i & ".doc"), FileMode.OpenOrCreate, _
                      FileAccess.Write)
                    fs.Write(MyData, 0, k)
                    ds.Tables("Try").Rows(i).Item(2) = Server.MapPath(".\Created" & i & ".doc").ToString
                    fs.Close()
                    fs = Nothing
                End If
            Next
            Con.Close()
            Con = Nothing

            Me.GridView1.DataSource = ds
            Me.GridView1.DataBind()
where my gridview declaration is :
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="370px">
            <Columns>
                <asp:BoundField DataField="ruid" HeaderText="Appno" ReadOnly="True" SortExpression="ruid" />
                <asp:HyperLinkField DataNavigateUrlFields="reportnm" DataTextField="reportnm" HeaderText="File" />
            </Columns>
        </asp:GridView>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Online editing in asp.net bneeraj General .NET 0 February 3rd, 2005 09:32 AM
Editing SINGLE record in ASP.NET Koofmich ADO.NET 5 December 30th, 2004 05:42 AM
Editing in Datagrid with ASP.NET rotsey General .NET 0 October 22nd, 2004 01:38 AM
Opening a MS Word document from ASP saturdave Classic ASP Basics 0 May 25th, 2004 01:47 PM
Text Editing/Modification in VB.Net/ASP.Net joevnvdvc VS.NET 2002/2003 0 July 29th, 2003 12:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.