Jump to content
Xtreme .Net Talk

cyclonebri

Avatar/Signature
  • Posts

    94
  • Joined

  • Last visited

About cyclonebri

  • Birthday 11/07/1974

Personal Information

  • Occupation
    Computer Programmer/System Administrator
  • Visual Studio .NET Version
    2003
  • .NET Preferred Language
    C#

cyclonebri's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Take it out of your global.asax. I think you are confusing application variables with session variables. A session variable, a cache variable, and a viewstate variable can be assigned or called from within any page in your application, just make sure you are using the correct one for what you are trying to accomplish. Also, if you are still having problems with your session variable, make sure your settings are correct in your web.config file and that you aren't timing out. Good Luck, Brian
  2. Hey Mike, I just built a small app that tested your question. I have found, at least on our system, that coming from a non-ssl page to an ssl page works fine if I use the fully qualified URL of the page I'm redirecting to, which places the correct qualifier in the address bar ("https://blah.blah.com/mypagetest.aspx") If you don't use the full qualifier, the address bar appears to retain the original http://blah.blah.com/mypagetest.aspx. This would be a problem if your site is secure and you don't automatically toggle your url string to https. Your best bet, if possible, would be to use the fully qualified URL, but there are articles where you can read more about these subjects if you want to try to toggle to use relative paths: These are some samples of what is out there: Setting up SSL with IIS And ASP.net Toggle between Https and Http Good Luck, Brian
  3. You can use server.transfer("URL?asdf=1&sadf=2&dasf=3") to move from one page to another without changing the visible text in the address bar. I am not sure this will work for you, however, if you are going to an app that is outside of your control (say mypage.aspx -> theirpage.aspx). You can also use hidden fields and request the hidden field on the 2nd page if you have control on the 2nd page, or session variables (again if you have control). If you can pass hidden variables outside of the query string, hidden is the best solution. If the variables must be in the query string, I would try the server.transfer. If what you are trying to do is get the three variables, post them to some url (or database) and transfer the client to another, then use server.transfer to first move to a second page in your app, execute the post, and then do the redirect. Hope that helps! Brian
  4. here is some vb code that I used to do what you are trying to do: dim sTest as string = "test" Response.Write("<script language=""javascript"">") Response.Write("try{ window.opener.document.forms[0].txtStartDate.value='" + sTest + "';}" + _ " catch (ex){alert(ex.description);}") Response.Write("self.close();") Response.Write("</script>")
  5. Glad it worked and that I could help out! I was also thinking, if you wanted to get crazy you could have the datagrid be passed into the function as well: Private Sub GridPagerVisibility(ByVal ShowHide As Boolean, byref dg1 as System.Web.UI.WebControls.DataGrid) dg1.PagerStyle.Visible = ShowHide End Sub Take Care! Brian
  6. Sure, all you need to do is add this function, and call it as you will: Private Sub GridPagerVisibility(ByVal ShowHide As Boolean) Me.DataGrid1.PagerStyle.Visible = ShowHide End Sub so you would say something like this on postback: if myFileCount < 100 Then GridPagerVisibility(False) else GridPagerVisibility(True) end if Good Luck!
  7. What exactly are you trying to do? Are you trying to save the fields in the textboxes to a text file? If so, you need to make an IO object, open a file and write the results: 'add this to the top of your project Imports System.IO '---- 'add this function and call it from your button_click event: Private Function SaveResults() As Boolean Try Dim myFile As FileInfo Dim myPath As String = "Enter_your_file_save_path_here.txt" 'delete the file if it is already there: myFile = New FileInfo(myPath) If myFile.Exists Then myFile.Delete() End If Dim mySW As New StreamWriter(myPath) mySW.WriteLine("This is the start of the results") mySW.WriteLine("VALUE 1: " + textbox1.text) mySW.WriteLine("VALUE 2: " + textbox2.text) '... mySW.WriteLine("This is the end of the results") mySW.Close() myFile = Nothing Return True Catch ex As Exception If Trace.IsEnabled Then Trace.Write("Error saving Results", ex.ToString()) Return False End Try End Function Also note -- If you are running this from an ASPX page, then you will have to have a writeable directory on your server, unless you impersonate a valid, authorized user. Good luck!
  8. In 2003 in order to access your control you need to add a reference to it, even after dragging it onto the page, by adding this to the form generated code: #Region " Web Form Designer Generated Code " ... Protected WithEvents hello as HelloWorld #End Region Then in your code you could reference the object hello.sayhello() Perhaps 2005 is similar? Good Luck!
  9. Hello All, I am having a problem related to DB2 and .Net, and was wondering if anyone could help me out. Basically, I can't connect, and I've tried many different ways. I can connect to DB2 if it's on a windows box, but the box I'm trying to connect to is a non-windows box, and is also at a remote location. What I need is to get one of two ways to work, so far I can't get either to work. The first way is using .net OLEDB and connecting via TCP/IP. The other is to use the .net Data application blocks by IBM and connect using the IP address as the server (I think I got in this way but the database name gets padded and then says it can't find it, so it errors out). Can anyone help? thanks! Sample Code: 'using oledb cs1 = "Provider=DB2OLEDB;Network Transport Library=TCPIP;Network Address=myNetworkAddress; Initial Catalog=myDB2Database;Package Collection=MyPkgCol;Default Schema=Schema;User ID=myUserId;Password=myPassword" 'using .net dab's from IBM cs1 = "Database=myDB2Database;UserID=myUserID;Password=myPassword;Server=TCPIPAddress" Thanks, Brian
  10. http://www.4guysfromrolla.com/ http://www.asp.net/Default.aspx?tabindex=0&tabid=1
  11. What are you trying to do with the label? Set some value from the class? If so, you need to add a public event in your class, and raise the event. You will also need to add an event handler on your default.aspx page, so that when the class raises the event you can have the label respond: in default.aspx, add the following code in your page load method (it needs to load each time, including post-backs: AddHandler YourClassVariable.SetLabelText, AddressOf SetLabelTextFromClass Also on default.aspx add the following method Public Sub SetLabelTextFromClass(byval newtext as string) label1.text = newtext '...whatever else you want to do on the event firing End Sub Inside your class, put the following Public Event SetLabelText(ByVal whatevertext As String) Then from whatever method inside your class that updates the text: '...inside the method RaiseEvent SetLabelText("Text set by class method x") Good Luck. If you need it to do something else, the best way to do so would be events. You could also use delegates but that is more complex and seems to have less functionality. Brian
  12. You can't send a redirect request to the response after you've sent headers to the response object for download. This causes an error: Cannot redirect after HTTP headers have been sent. (use try catch blocks in your code and enable tracing to see your code error out). There are a couple of different solutions you can try. There may be other solutions but these are the ones that come to mind. I would also be interested to see an easier solution, but i've tried all the server.transfer, server.execute, writing new response headers, embedded controls and other things that I can think of for a Friday afternoon. Anyway, you can make one of these work: 1) You can have a pop-up page which downloads the file and closes itself (simple javascript). (if you are allowed to use pop-ups). 2) You can build a web-service which allows downloads of files and call the object from your webservice within the aspx page to get files from the server without using the response headers. After the file is downloaded you can then redirect the page as expected. This is more difficult but extremely solid when completed correctly. 3) You can use an I-frame, embed the page inside of a menu page and redirect on the menu page using some sort of delegate writeback to the menu once the file is downloaded from the download page. This solution is probably the worst of the three choices IMHO.
  13. What database backend are you using, because it could make a difference in how you execute the code? You will need to use a command object, either odbc or sql and then add a parameter and set it's value for each passed in parameter, as well as it's type and size. You will therefore also need to pass in the parameter name and parameter type (int, varchar, bit, etc), as well as the size expected (i.e. 50, 4, etc), along with the parameter value and sp name (you will want to use something other than a single array I think, otherwise you will have to do some kind of parsing on the backend, or use a multidimensional array). In this manner you could set it up based on the number of records in the array. If you are using an ODBC you will also need this number to generate the (?, ?, ?, ..., ?) string for the number of parameters. Also remember that if it is an ODBC you have to specifically set the return parameter on all sp execution, whereas with sql this is not necessary. When generating the parameters you will need to be wary of the type that the parameter is supposed to be, and set it accordingly (which also brings to mind the size variable). You will also need to take into account null values and how you will handle them, because what if an sp requires 10 values but you've only passed in 7 and the other three are supposed to 'just be null?' Good Luck.
  14. When the user is clicking on the action button, is there a write to the db you could trap with the new data and determine what is being changed at this point, rather than trying to compare the two datasets after the write, or is this just a new pull from the db with some other alterations happening via a different process in the elapsed time from page-load to button push?
  15. The moon is really made of cheese... The moon is really made of cheese... When you go to the link posted above, zoom in to the maximum zoom and you will see that the moon really is made of cheese. I'd say cheddar or american. Funny stuff...
×
×
  • Create New...