开发者

How do I save the status of a radio button?

My question is: How do I export the status of a radio button (checked or not) to a text file and read it back in so the button开发者_如何学编程 assumes the saved status?

I feel it might be something simple but am at a complete loss.

Any help will be greatly appreciated!


Save the boolean value of the radio button's Checked property as an integer:

True  = 1
False = 0

Read it back in and assign the value back to the Checked property.


Well, you could store the state of the button, then Write its state to a text file, then read its state from the text file. You would read the last line from the text file, and then you would have a few options on what to do next, such as use an if statement to decide what to do given what you read from the text file. Those two links should help you. The rest is up to your logic needs.


More than likely, you need to save the Radio button's state to a variable, write the variable to a text file and read the text file back into your program.

At that point you'll need some interpreter between the text file and the Radio Button to change the its state.


In what context would you need to do this? In most cases you save user data in a database, with the key being their userid. If you are doing this because you need the value in another web page and you are using asp, check out viewstate. Remember that doing filesystem io is hideously slow compared to in memory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜