OnCheckedChanged trouble with codebehind method

T

theycallmetish

hey. i'll get right into it. i've got a codebehind page and m
presentation page. i've got this code for my checkbox, which in theor
is supposed to (when checked) take the first and last name of th
filled out form and put the same text into two other textboxs furthe
down the page. here's the code

public void payableBox_CheckedChanged(Object sender, EventArgs e)
{
if (payableBox.Checked)
{
payfname.Text = fn.Text;
paylname.Text = ln.Text;
}
else
{
payfname.Text="";
paylname.Text="";
}
}

and

<asp:checkbox id="payableBox" Text="Same Address as above
OnCheckedChanged="payableBox_CheckedChanged" checked="false
AutoPostBack="true" runat="server"></asp:checkbox>



i keep on getting this compile error

CS0117: 'ASP.signup_aspx' does not contain a definition fo
'payableBox_CheckedChanged'

can anyone help
 
G

Guest

Please check your InitializeComponent() method in your page.

It should include following code:
this.payableBox.CheckedChanged += new
System.EventHandler(this.payableBox_CheckedChanged);
 
E

Eliyahu Goldin

That is only if you setup the event handler in Design view in the property
box. Setting the handler in .aspx page doesn't affect InitializeComponent()
..

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top