Jump to content
Xtreme .Net Talk

MisterB

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by MisterB

  1. Hi All, Does anyone know if there is a kind of folder picker in ASP.NET 2.0 ??? or another way to do so?? Tnx MrB
  2. Found it :) here is the code '-- Moving a file Dim fs, f fs = Server.CreateObject("Scripting.FileSystemObject") f = fs.GetFile("c:\test.txt") f.Move("\\Myserver\Uploads\test.txt") f = Nothing fs = Nothing '-- Moving a folder Dim fs, fo fs = Server.CreateObject("Scripting.FileSystemObject") fo = fs.GetFolder("c:\test") fo.Move("c:\asp\test") fo = Nothing fs = Nothing
  3. Do you know how I can do that? ( because i don't :() Tnx Mrb
  4. Hi This is how i do it in VB I'n not sure how to do it in C# Hope it helps! Page.Response.Write("<script type=""text/javascript"""> var someJSvariable="& yourappvarvalue & "</script>") Cheers Mrb
  5. Hi Reader ;) I've got I question about a fileupload control. In my webapp. I've got a fileuploadcontol that uploads the file to a folder on the webserver ( eg. C:\Inetpub\wwwroot\UploadedFiles) NOW.... what i want is.. if a file is uploaded it is uploaded to another server ( the server where the webapp runs on is eg myserver so the upload folder is myserver\uploadedfiles and i want it to be stackserver\files ) I would like to do this because the webserver has virtualy no HD space and the stack server has several TB (:D:0) any idears??? Tnx Mrb
  6. Hi try to do this. Partial Class _Default Inherits System.Web.UI.Page Protected Sub DataGrid1_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemCreated '-- This is just for testing.. Dim DDbox As New DropDownList Dim IntCounter As Integer Dim DgCell As New TableCell '-- Fill the dropDownBox with dummy data For IntCounter = 0 To 5 DDbox.Items.Add("Item " + IntCounter.ToString) Next '-- Put the filled DDbox in a cell DgCell.Controls.Add(DDbox) '-- add the cell to the Datagrid e.Item.Cells.Add(DgCell) End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim DgRow As DataGridItem Dim DDBox As New DropDownList ListBox3.Items.Clear() '-- loop thru the rows of the datagrid For Each DgRow In DataGrid1.Items '-- set te DDbox control DDBox = DgRow.Cells(3).Controls(0) '-- add the selected item value to the result listbox or your own result object :) ListBox3.Items.Add(DDBox.SelectedItem.ToString) Next End Sub End Class Good luck! MrB
  7. Tnx for your reply. ... I've solved the problem by 'destroying' the session obeject on the first load... Not realy the way but... it wordks... Tnx again! Take care! Mrb
  8. Hi all, I've got a question, What I want to do is this: if a page is UNLOADED say by clicking on a close button on the page OR by clicking on the (x) button on top of the window),I want to set a few session objects to nothing. But..... When I try to do this via the Page_Unload event it does it every tim the page loads and reloads... So.. this is not realy what i want... and.... if I click the (x) button the event doen't fire @ all.. :confused: So Now I'm stuck with a session object... that isn't destroyed after the window is closed.... Does anyone have any ID?? Tnx
  9. I found a sort off work around... ( ****ty but hey... that MS right? ;) ) What I did is Create all Panels, buttons, and images on the page ( if you set the visible on false the objact cant be fetched by javascript...) In the onload event of the aspx page I call a Javascript function <body onLoad="HideLabels()"> This function function HideLabels() { document.getElementById('LblLoading').style.visibility = "Hidden"; document.getElementById('imgLoading').style.visibility = "Hidden"; } This will hide the "Please wait while file is being uploaded" label and its STATIC image ( sinds animated images 'hang' when you upload a file) When the user clicks Upload first a Javascript functions is called to hide and show some labels. <asp:Button ID="BtnUpload" runat="server" Style="left: 10px; position: relative; top: 22px" Text="Upload" OnClientClick="ShowThoseThings" /> function ShowThoseThings() { document.getElementById('PnlUpload').style.visibility = "Hidden"; document.getElementById('LblLoading').style.visibility = "Visible"; document.getElementById('imgLoading').style.visibility = "Visible"; } Op the Page.load in the VB code the upload process starts.. en when finished sets another label :) Thanks for your time! Hope it helps Cheers Mrb
  10. dawn!! afer seaching the internet for one hour and not finding anything usefull and after posting this thread.. I found what I was looking for... and it's quite simple to... VB.NET Dim Filename As String Filename = "YG67S3797XHIHRWKS3J4WN8PQ9AY4I75WICJ862E.doc" Response.ContentType = "application/vnd.ms-word" Response.AppendHeader("Content-Disposition", "attachment; filename=this is an example.doc") Response.WriteFile(Server.MapPath("~/UploadFolder/" + Filename)) Response.Flush() Other Content Types: vnd.ms-excel - For Excel vnd.ms-powerpoint - For PowerPoint vnd.ms-project - For Microsoft Project pdf - For Adobe Acrobat Documents rtf - For Rick Text Documents vnd.lotus-wordpro - For WordPro vnd.lotus-1-2-3 - For Lotus 1-2-3 vnd.visio - For Visio jpeg - for JPG Image File gif - for GIF Image File png - for PNG Image File Cheers MrB
  11. Hi All, I've got a question, I've created a upload page with which I'm able to upload file to my server. When a file is uploaded it get a random filename on the server preventing that user get the error file allready exists. In a DB I've stored the original name of the file. Is there a way I can change the name of the download file for teh user eg. I upload a file called "this is an example.doc" it will be stored at the server as "jbytbxtwra436qwvyuxas564eq7wvf7q9xwe .doc" Now when the user downloads the file I want it to be called "this is an example.doc" again.. is this posible?? Tnx! Mrb
  12. Yup, that's what I tried.. but... when I click the upoload button, the animated gif freezes... :S until the file is totaly uploaded.. ( so that's NOT what i want) furthermore ... the hole page freezes.. I even can't enable/ disable the buttons. ( to prevent the user clicking 12 times in a row while the file is loading) ... stange huh? Any idear hoe this is posible??
  13. Hi All, I've got a realy strange problem. I've got an ASP application installed on iis (ver. 6) When I test the application via the intranet ( by typing the ip adress of the server in directly) everything works fine.. On the left side of the application I've got a tabstrip for navigation and via the intranet I can select anything I want and it works fine. Now when I test the application via the I-Net( by going to the domain) the tabstrip does NOTHING :confused: (***..) It shows just plain text... So I can't select anything... :( ( its the same computer I'm testing on so it won't be the explorer settings.. I've allready tried to set everythin on enabled, but no result) Next I went and had a look at the setting in IIS... but as you allready guessed... even after setting everything on enabled, allowed and OK... It still doen't work :mad: Does anyone have any idear what it could be... :confused: Thanks :-\
  14. Allright here we go Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim UploadPath As String = ConfigurationSettings.AppSettings.Get("UploadPath") '-- This is the loading image ImgLoading.Visible = False '-- The upload button generates a postback If IsPostBack Then '-- Show the loading image ImgLoading.Visible = True Dim path As String = Server.MapPath("~/" + UploadPath + "/") Dim fileOK As Boolean = False If FileUpload1.HasFile Then Dim fileExtension As String fileExtension = System.IO.Path. _ GetExtension(FileUpload1.FileName).ToLower() Dim allowedExtensions As String() = _ {".jpg", ".jpeg", ".xls", ".pps", ".doc"} For i As Integer = 0 To allowedExtensions.Length - 1 If fileExtension = allowedExtensions(i) Then fileOK = True End If Next If fileOK Then Try FileUpload1.PostedFile.SaveAs(path & _ FileUpload1.FileName+ fileExtension) Label1.Text = "File uploaded" Catch ex As Exception Label1.Text = "File can't be uploaded" End Try Else Label1.Text = "File extention is not allowed" End If End If '-- and hide the loading image again ImgLoading.Visible = False End If End Sub Weel that's it realy :)
  15. Yup via the upload control ( I will post some code tomorrow :) )
  16. Hi All, Does anyone know if or how it is posible to show or an image or a progressbar while uploading a lage file. I've seached the forum/i-net but didn't find anything usefull :o I'm using VS2005 and tried to hide/unhide an image but with no success. Thanks!
  17. Hi all, I'm trying to get the tabstrip to work in visual studio 2005 (http://www.asp.net/ControlGallery/ControlDetail.aspx?Control=73&tabindex=2) but... you'll allready will have guessed it.... it doesn't work.. I followed the readme instructions but I cant get it to work! Does anyone knows if the tabstrip just won't work in VS2005? or that is something else?? any ideas??? Thanks! cheers Maarten
×
×
  • Create New...