While going through the checkBox I found there is written
CheckBox checkbox = (CheckBox)sender
on checkBox1_CheckedChanged
event.
Please explain what it means?
ASP.NET Web Forms CheckBox. It is used to get multiple inputs from the user. It allows user to select choices from the set of choices. It takes user input in yes or no format. It is useful when we want multiple choices from the user.
The OnCheckedChanged event handler of the ASP.Net Checkbox control allows us to handle the click event of a checkbox at the server side that is raised when the user clicks the checkbox control to changes it checked state.
The line simply casts sender
to a CheckBox
.
Why?
The event handler signature for the CheckedChanged
event is:
CheckChanged(object sender, EventArgs e)
So, you need to cast sender
back to a CheckBox
if you want to use any CheckBox
specific functionality - object
doesn't have much that you can use...
This way the checkbox
variable can be used to get the checkbox Id and operate on the checkbox.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With