| | |
How to call a class
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2007
Posts: 2
Reputation:
Solved Threads: 0
I have worked with asp.net for about two month and have not worked with class yet.
I have a form with 10 usercontrols who contains dropdownlists, checkboxes, textboxes and more. My client have to make a dynamic requestform to send out to his members.
This part is working fine.
After the form is sent, I want to save the viewstate in a file, so that the client can access it anytime edit it.
I found the code for saving and loading the viewstate. It is in a class.
Now I don't know how to call the class in the page_load() so that the viewstate is saved and loaded.
This is the class :
The code is in my aspx page.
I have a form with 10 usercontrols who contains dropdownlists, checkboxes, textboxes and more. My client have to make a dynamic requestform to send out to his members.
This part is working fine.
After the form is sent, I want to save the viewstate in a file, so that the client can access it anytime edit it.
I found the code for saving and loading the viewstate. It is in a class.
Now I don't know how to call the class in the page_load() so that the viewstate is saved and loaded.
This is the class :
VB.NET Syntax (Toggle Plain Text)
public class PersistViewStateToFileSystem : inherits Page public ViewStateFilePath = server.MapPath("/album/myViewstate.txt") Protected Overloads Overrides Sub SavePageStateToPersistenceMedium(ByVal viewState As Object) ' serialize the view state into a base-64 encoded string Dim los as LosFormatter= new LosFormatter() Dim writer as StringWriter= new StringWriter() los.Serialize(writer, viewState) ' save the string to disk Dim sw as new StreamWriter(ViewStateFilePath, false) sw.Write(writer.ToString()) sw.Close() end sub Protected Overloads Overrides Function LoadPageStateFromPersistenceMedium() As Object ' determine the file to access if NOT File.Exists(ViewStateFilePath) return nothing else ' open the file Dim sr as StreamReader= File.OpenText(ViewStateFilePath) Dim viewStateString as string = sr.ReadToEnd() sr.Close() ' deserialize the string Dim los as LosFormatter = new LosFormatter() return los.Deserialize(viewStateString) end if end Function end class
The code is in my aspx page.
![]() |
Similar Threads
- is it possible for PHP to call API written on java ? HELP (Java)
- how can i call class in other project (C#)
- Expert in Class Creation & Implementation Needed (VB.NET)
- Documents (Java)
- Code is written, but not working. (Java)
- Using Resources in Visual C++ (C++)
- Working with objects of different Classes (Java)
- New to Java (Java)
- printf buffer strange behaviur (C)
Other Threads in the VB.NET Forum
- Previous Thread: SQL express on a remote machine
- Next Thread: How to create an instlallation file in VB.net??
| Thread Tools | Search this Thread |
.net .net2005 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dissertationthesis dropdownlist excel fade file-dialog folder ftp generatetags google hardcopy image images input insert intel internet login mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 port print problem problemwithinstallation project reports" save savedialog searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer toolbox trim update updown user usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





