|
I'm trying to open a server side MS-Word document and present it client side. I just want the word document to appear inside the browser or open up for viewing. When I run the code I'm prompted to "Open" or "Save" the file. If I "Save" the file it is the file that I requested but if I "Open" I get the following error: "This file could not be found. Try one or more of the following: * Check the spelling of the name of the document. * Try a different file name."
Code:
Dim _webClient As New System.Net.WebClient
Dim sURI aAs String = "file://C:\test.doc"
Dim theBuffer As Byte() = _webClient.DownloadData(sURI)
With Page.Response
.ClearContent()
.ContentType = "application/msword"
.AddHeader("content-disposition", "attachement;filename=test.doc")
.OutputStream.Write(theBuffer, 0, theBuffer.Length)
.End
End With
_webClient.Dispose()
bgates1970
|
|
|
|
|
Where is the document stored?
If it's stored on the client computer, you can't load it that way. The file that you are trying to get with the DownloadData call is located on the server.
bgates1970 wrote: If I "Save" the file it is the file that I requested
Have you verified the contents of the file that you saved? I think that you will find that it's not at all the document that you have saved, but the error message.
---
b { font-weight: normal; }
|
|
|
|
|
The file I'm trying to load is located on the server (Windows 2003 SP1). I have verified that the file that I "saved" is indeed the same file.
bgates
|
|
|
|
|
Why on earth are you using a web request to open a file on the same server, then? Use the IO.File class to open it.
---
b { font-weight: normal; }
|
|
|
|
|
Hi everyone
Could anyone tell me how to get the selected text (not all text) in textarea.For example in textarea i type "Hello everyone have a nice day" .I use mouse to select just the word "day".I would like to get the value of the selected text (in this case "day").How to get it?Thanks for reading.
|
|
|
|
|
Hi,
Use
Textbox1.SelectText
property.
Hope This Works.
Nitin...
|
|
|
|
|
I m trying to visible the panel or table onmouseover event in asp.net 1.1 (which contain certain links from which i want to nevigate to other page). How can i visible the panel or table only after onmouseover the button or linkbutton or hyperlink?
plz tell any one knows!!!
-- modified at 10:02 Saturday 19th August, 2006
B.N.Thorat
9881215484
Mumbai
|
|
|
|
|
I haven't done anything particular with the onMouseOver but with the click event for a button. I'm guessing they may be similar.
btn.Attributes.Add("onClick", "javascript:alert('TEST');");
|
|
|
|
|
hi
how to do this
Upload new modules -- Each module consist of ascx (asp/net user controls) & programming script and database script – modules can be any programming/database (PHP/mySQL or ASP/mySQL or ASP/Access or PHP/Access or Asp.net/MS SQL etc etc)
– every time a new module is added the super admin can specify the programming and or database.
this is one of the point of my project specification. not getting how to do this.
thanx
|
|
|
|
|
A starter might be to look at DotNetNuke. However, it is only ASP.NET. And I'm not exactly sure how you'd put PHP into an ASCX file.
|
|
|
|
|
how we make side menu bar using asp.net1.1
omi
|
|
|
|
|
|
i already try but it is for limited time
omi
|
|
|
|
|
|
Hi,
I'm using a simple Infragistic web combo in ASP .net with code behind in VB .Net 2003. It's a very basic combo box that is working fine with code behind in C# .Net but the same code (logic) is not working in VB .Net. The problem I'm facing is that when I click on button1 and in it's event I simply write:
WebCombo2.SelectedRow.Cells(0).Value.ToString()
and it returns with a null object reference exception. When I debugged, I found the SelectedRow object null.
I'm using:
-> Infragistics NetAdvantage 2006 Volume 2 CLR 1.x
-> VS 2003 ASP .Net, code behind in VB .Net
here is the code:
<igcmbo:webcombo id="WebCombo2" runat="server" Height="20px"
DataValueField="User_Id" DataTextField="Logon_Name" Width="200px" Font-Names="Verdana" DataMember="User" Font-Size="8pt" BorderStyle="Solid" BorderWidth="1px" SelBackColor="LightSteelBlue" BackColor="White" ForeColor="Black" SelForeColor="51, 51, 51" Version="2.00" BorderColor="Gainsboro">
<Columns>
<igtbl:UltraGridColumn
HeaderText="User Id" Key="User_Id" IsBound="True" BaseColumnName="User_Id">
<Footer
Key="User_Id"></Footer>
<Header Key="User_Id"
Caption="User ID"></Header>
</igtbl:UltraGridColumn>
<igtbl:UltraGridColumn
HeaderText="Logon Name" Key="Logon_Name" IsBound="True"
BaseColumnName="Logon_Name">
<Footer
Key="Logon_Name"></Footer>
<Header
Key="Logon_Name" Caption="Logon Name"></Header>
</igtbl:UltraGridColumn>
</Columns>
<DropDownLayout DropdownWidth="450px"
BorderCollapse="Separate" AllowColSizing="Free" RowHeightDefault="20px"
HeaderClickAction="Select"
RowSizing="Free" DropdownHeight="180px" TableLayout="Fixed"
AllowRowSizing="Free">
<RowStyle BorderWidth="1px"
Font-Size="8pt" Font-Names="Verdana" BorderColor="Gainsboro"
BorderStyle="Solid"
BackColor="White"
Height="18px">
<Padding Left="5px"
Right="5px"></Padding>
</RowStyle>
<SelectedRowStyle
ForeColor="White" BackColor="SteelBlue">
<Padding Left="5px"
Right="5px"></Padding>
</SelectedRowStyle>
<HeaderStyle
VerticalAlign="Middle" BorderWidth="1px" Font-Size="8pt" Font-Names="Verdana"
BorderColor="White"
BorderStyle="Solid"
HorizontalAlign="Left" BackColor="LightSteelBlue">
<Padding Left="3px"
Right="3px"></Padding>
</HeaderStyle>
<RowAlternateStyle
BackColor="#E0E0E0"></RowAlternateStyle>
<FrameStyle Width="450px"
Cursor="Default" BorderWidth="1px" Font-Size="8pt" Font-Names="Verdana"
BorderStyle="None"
BackColor="Gainsboro" Height="180px"></FrameStyle>
</DropDownLayout>
<ExpandEffects
ShadowColor="LightGray"></ExpandEffects>
</igcmbo:webcombo>
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 152px; POSITION:
absolute; TOP: 56px" runat="server" Text="Button"></asp:Button>
I'm binding the Infragistic webCombo to a DataSet.
Plz help,
Thanks.
|
|
|
|
|
HI,
hw r u all,i have a problem ,i have a website that i made in asp.net and vb.net.in this website i want to uppload image on my websever folder name as "Images",and that images i displayed in my datagrid..locally on my machine its working well,bt no i want to test it on my webserver,tell me how can i athunticate against the username and password that my webserver used to uplaod files,here ist he code that i locally use
Dim f_info As New FileInfo(UploadFile.Value)
If f_info.Extension = ".bmp" Or f_info.Extension = ".gif" Or f_info.Extension = ".jpg" Then
Dim f_name As String = System.IO.Path.GetFileName(UploadFile.Value)
'f_name=f_name.Replace(f_name.Substring(0,f_name.
Dim insert_path As String = "images/" + f_name
Dim save_location As String = Server.MapPath("../images" + "/" + f_name)
'Dim phy_location As String = Request.PhysicalPath
UploadFile.PostedFile.SaveAs(save_location)
Image_SaveToDBURL(insert_path).
tell me how can i uplaod image on the webserver through proper Authentication
kindly help me in this regard
|
|
|
|
|
|
Hi all;
I want to be able to get the total number of rows in a gridview with out any sql code.
How would I do that?
Thanks
Hadi
|
|
|
|
|
U may use DataBound event of GridView, and use the Property
Gridview1.Rows.Count
Hope it helps u..
Regards,
Jay
|
|
|
|
|
Thanks for the reply, but this is not what I wanted. what you suggested only returns the number of rows per page. not all the rows of a gridview which is bounded.
I found the answer. You have to use the Selected event of the DataSource which you have bounded to the gridview.
e.AffectedRows
Thanks again
Hadi
|
|
|
|
|
Thanks Hadi, for your information. Its very useful.
Regards,
Jay
|
|
|
|
|
comm.CommandText = "select BrandID, Brand, ('Logo_Pics/'+BrandLogo) as BrandLogoFile from Brand";
SqlDataReader dr2 = comm.ExecuteReader();
DropDownList1.DataSource = dr2;
DropDownList1.DataBind();
dr2.Close();
this code above is to bind the sql database data to my dropdownbox1
i need help to make the first choice of the drop down list box to all
without putting in inside the sql database
can this be done?
example:
old:
1 // from sql
2 // from sql
3 // from sql
wat i want:
All // not from sql
1 // from sql
2 // from sql
3 // from sql
|
|
|
|
|
Hi,
First of all fill the drop down combo with the sql output. Then insert new item like this -
DropDownList1.Items.Insert(0, "All");
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
|
thx u it works like a dream haha
|
|
|
|