I can very simple save a serilized class to a server, but i don't know how to
serilize an object (here a business object) to a variable so that it can be
saved to viewstate or passed to another page?
here is my to disk version:
private void ser()
{
var fs = new FileStream(@"e: \websites\Seria lizedClassData" ,
FileMode.Create );
// Create a BinaryFormatter object to perform the serialization
var bf = new BinaryFormatter ();
var dt1 = DateTime.Now;
var dt2 = DateTime.Now;
DateTime.TryPar se(ddlStart.Sel ectedValue, out dt1);
DateTime.TryPar se(ddlEnd.Selec tedValue, out dt2);
var AAIL = AAISummaryManag er.GetList(dt1, dt2);
// Use the BinaryFormatter object to serialize the data to the file
var bcls = new object();
bf.Serialize(fs , AAIL);
// Close the file
fs.Close();
}
now how do i serilize to a variable?
thanks!!
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes 5 3155
as long as your object is serializable, you just add to viewstate. it
will be serialized when viewstate is converted to a hidden field.
your object should not be too large as view serializes to a memory
stream, then encrypted (which increases the size) then its converted to
base64 string which is 3 bytes for every 2 bytes input. all this data is
sent to the browser, then the browser has to send it back on a postback
-- bruce (sqlwork.com)
WebBuilder451 wrote:
I can very simple save a serilized class to a server, but i don't know how to
serilize an object (here a business object) to a variable so that it can be
saved to viewstate or passed to another page?
here is my to disk version:
private void ser()
{
var fs = new FileStream(@"e: \websites\Seria lizedClassData" ,
FileMode.Create );
// Create a BinaryFormatter object to perform the serialization
var bf = new BinaryFormatter ();
var dt1 = DateTime.Now;
var dt2 = DateTime.Now;
DateTime.TryPar se(ddlStart.Sel ectedValue, out dt1);
DateTime.TryPar se(ddlEnd.Selec tedValue, out dt2);
var AAIL = AAISummaryManag er.GetList(dt1, dt2);
// Use the BinaryFormatter object to serialize the data to the file
var bcls = new object();
bf.Serialize(fs , AAIL);
// Close the file
fs.Close();
}
now how do i serilize to a variable?
thanks!!
Thanks for replying,
Maybe i should be asking: How do i serilize it and keep on the server. Then
be able to recall it during the post back. Instead of re hitting the db?
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes
"bruce barker" wrote:
as long as your object is serializable, you just add to viewstate. it
will be serialized when viewstate is converted to a hidden field.
your object should not be too large as view serializes to a memory
stream, then encrypted (which increases the size) then its converted to
base64 string which is 3 bytes for every 2 bytes input. all this data is
sent to the browser, then the browser has to send it back on a postback
-- bruce (sqlwork.com)
WebBuilder451 wrote:
I can very simple save a serilized class to a server, but i don't know how to
serilize an object (here a business object) to a variable so that it can be
saved to viewstate or passed to another page?
here is my to disk version:
private void ser()
{
var fs = new FileStream(@"e: \websites\Seria lizedClassData" ,
FileMode.Create );
// Create a BinaryFormatter object to perform the serialization
var bf = new BinaryFormatter ();
var dt1 = DateTime.Now;
var dt2 = DateTime.Now;
DateTime.TryPar se(ddlStart.Sel ectedValue, out dt1);
DateTime.TryPar se(ddlEnd.Selec tedValue, out dt2);
var AAIL = AAISummaryManag er.GetList(dt1, dt2);
// Use the BinaryFormatter object to serialize the data to the file
var bcls = new object();
bf.Serialize(fs , AAIL);
// Close the file
fs.Close();
}
now how do i serilize to a variable?
thanks!!
look at session, its for storing on the server. there is an inmemory or
sqlserver version. i always use the sqlserver version. you can also
serialize to a database, and store a key in a hidden field on the page.
-- bruce (sqlwork.com)
WebBuilder451 wrote:
Thanks for replying,
Maybe i should be asking: How do i serilize it and keep on the server. Then
be able to recall it during the post back. Instead of re hitting the db?
Very appreciated! I have no idea why i did not think of session. I normally
use the inmemory, but may go for the sql version.
Thanka!
"bruce barker" wrote:
look at session, its for storing on the server. there is an inmemory or
sqlserver version. i always use the sqlserver version. you can also
serialize to a database, and store a key in a hidden field on the page.
-- bruce (sqlwork.com)
WebBuilder451 wrote:
Thanks for replying,
Maybe i should be asking: How do i serilize it and keep on the server. Then
be able to recall it during the post back. Instead of re hitting the db?
that's the answer!!
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes
"bruce barker" wrote:
look at session, its for storing on the server. there is an inmemory or
sqlserver version. i always use the sqlserver version. you can also
serialize to a database, and store a key in a hidden field on the page.
-- bruce (sqlwork.com)
WebBuilder451 wrote:
Thanks for replying,
Maybe i should be asking: How do i serilize it and keep on the server. Then
be able to recall it during the post back. Instead of re hitting the db?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Samuel R. Neff |
last post by:
Are there any tools available to view a file containing a binary
serialized object in a friendly format? Something to list classes and
data and such?
Thanks,
Sam
B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
|
by: Adrijan Josic |
last post by:
I have a bunch of user controls that contain TextBoxes,
Repeaters and so on. Some of the user controls even
contain other user controls. The user controls also
usually have some of their properties saved in viewstate.
What I need is: if a user control is not visible it
shouldn't save it's viewstate or the viewstate of the user
controls and server controls it contains and so on
recursively. Im guessing I should override the
SaveViewState...
|
by: Leo Muller |
last post by:
I tried to simplify my problem.
What I want to do is to save a string in a variables, and everytime I click
a button, the variable string gets a bit longer by adding the time to it: on
the form there is a button. Somehow the submit seems to initialize the
variable again, rathen then keeping its previous state/value.
The variable has to be public to all methods in the class.
codebehind:
|
by: Fabuloussites |
last post by:
I'm considering deploying an application that will us an IP address locaiton
database provided by Ip2location.com...
http://www.ip2location.net/ip2location-dotnet-component.aspx
their .net component reads data from a binary file. I'm guess i'm wondering
which of the two options would be best.
1) read data from the binary files (~27 mb or so)
2) or query a sql DB with the same info.
|
by: madani |
last post by:
Hi,
I need to get serialized string of Page ViewState in Constructor of my
custom web control.
I can not override SavePageStateToPersistenceMedium Method of page
object because I'm in different class. and Page.ViewState is not
serializable.
Is there any way to get serialized string of ViewState without
overriding SavePageStateToPersistenceMedium ?
| |
by: MMiGG |
last post by:
Hi
Our project need parse JAVA serialized object string in C, has any library?
Thanx
|
by: bminder |
last post by:
I have a web user control that contains a serializable class. I persist
this class in viewstate, but on postback, the viewstate is null. Is
this behavior by design?
This technique works fine on regular pages -- just not in a control.
Is the main page's viewstate interfering with the control's viewstate?
Thanks,
|
by: Irene |
last post by:
Hello all!
I'm creating a web site in ASP.NET (VB.NET). One of the requirements was to
allow users to create orders going through several steps. A must have is to
have an option to save the work in any phase (any step) and to be able to
continue later.
My idea was to create several pages as steps (no, wizard control is not
suitable for several reasons) and to allow users to save any step to the
database, that is, a ViewState of the...
|
by: Richard Lewis Haggard |
last post by:
I have an application that can't use the registry to save various user
options and application settings. My first thought was to simply use an
application configuration file but this approach seems flawed. The app
config file appears to be updated with values while the application is
running but when the application closes, the file seems to get restored to a
pristine state and the accumulated user options and application settings are...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |