Reputation: 10345
I'm trying to change the value of my textbox by clicking on a radio button. But when I click on that radio button, nothing happens! Does someone know why? Here is the code:
protected void rbOpgelost_CheckedChanged(object sender, EventArgs e)
{
tbEinddatum.Text = DateTime.Now.ToString();
}
Upvotes: 0
Views: 799
Reputation: 1457
AutoPostback must be set to true since you are assigining text to the textbox control from the codebehind in the **rbOpgelost_CheckedChanged** property of the radio button whcich is executed on the serverside.
If autopostback is not set to true the checkedchanged event wil not be fired until a post back occurs.
Upvotes: 1
Reputation: 377
Are you using ASP.Net controls? If so you can enable AutoPostback to achieve this affect. If you're using standard HTML, or you don't want to enable AutoPostback, then you need some other mechanism to activate the change such as a form submit.
Upvotes: 1
Reputation: 10754
Is AutoPostback set to true on the radio button?
Also when you say "click on that radio button" are you clicking on a radio button that is already checked as this won't fire the checkchanged event.
Upvotes: 2