Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
1.89/5 (2 votes)
Hello,

I want to save state of a checkbox and later reopen it again showing those information as I marked on checkbox, e.g. I have around 20 checkboxes and maximum number to check them in real life is 10, but they are always different, how do I save those information given to an external file without database, any idea?
Posted
Comments
Sergey Alexandrovich Kryukov 29-Dec-15 16:04pm    
Are you sure you need external file and nothing else? That file could be on the server side, but it may not be the best approach.
—SA

You can use localStorage, HTML5 Web Storage[^]. It works similar to cookies.
 
Share this answer
 
Comments
Medin Smaili 18-Jan-16 15:23pm    
problem is that i am saving in external file localy
ZurdoDev 18-Jan-16 15:25pm    
My suggestion is don't use an external file. You can't on the client's machine anyway.

So, you must mean on the server side? If so, what is the problem? If you are already storing the values in a file then what is the problem?
Medin Smaili 18-Jan-16 15:28pm    
I wanna update the program as well, but later of course adding the web based app, database and fixing all bugs that I have currently, to be paid fully. hope you understand why I added external files :)
ZurdoDev 18-Jan-16 15:30pm    
No, I don't understand why, but that is not important. What IS important is what exactly is your question then?
Medin Smaili 18-Jan-16 15:33pm    
Okay, I have three rows with the check box selection:
First Row: chkbx1, chkbx2, chkbx3
Second Row: chkbx1, chkbx2
Third Row: chkbx1, chkbx2
in this three rows in each row should be selected one check box so I need those check box state to be saved in saveFileDialog
C# Corner : Error Display[^]


Read Above link first ... then below link to maintain hash table in view state


How to persist a property of type HashTable in viewstate - asp.net.state-management[^]
 
Share this answer
 
Comments
CHill60 15-Mar-16 9:16am    
Use the Improve solution link to update your posts instead of posting another solution - it is confusing
u can maintain a hash table in viewstate . with key -value pair . and update it on the postback of each checkbox . and do the things . . try it
 
Share this answer
 
Comments
Medin Smaili 18-Jan-16 15:24pm    
can you send me a demo link please cause i'm still begginer
Ashutosh shukla207 15-Mar-16 9:20am    
you can read more about the features of viewstate from here :
http://stackoverflow.com/questions/18821957/assigning-datatable-to-viewstate-is-a-good-way

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900