I am trying to make a small change to the createaccount.aspx page that was requested. I am attempting to make it so that, when creating a new account, the first name, last name and phone number are automatically copied from the Account and contact information pane to the Billing Information panel when the same as account info box is checked, as opposed to the default behaviour that copies on the OnClick event of the check box.

I am using the onChange event of the FirstName, LastName and Phone boxes in the account control to copy to the Billing Information. For some reason this works fine for the First and Last Name but gives an error for the phone number. It is obvious from the error message that the compilier can't find the txtPhone box, but I can't figure out why?

For instance this works fine:

ctrlAccount.txtFirstName.Attributes.Add("onchange", "copyaccountFirst(this.form);");

But this will give an error:

ctrlAccount.txtPhone.Attributes.Add("onchange", "copyaccountFirst(this.form);");

The error message is this:

'AspDotNetStorefrontControls.Account' does not contain a definition for 'txtPhone' and no extension method 'txtPhone' accepting a first argument of type 'AspDotNetStorefrontControls.Account' could be found

I have checked the source code and it sure looks to me like the Account Control does have a definition for txtPhone, and when I check the rendered source code it is there, so does anyone know why this might work for the name but not phone number elements of the control?

I have even tried to narrow it down by using a simple alert box, but again this works fine, and pops up a message box when the text is changed:

ctrlAccount.txtFirstName.Attributes.Add("onchange", "alert('hello,world')");

But this gives the same compilation error:

ctrlAccount.txtPhone.Attributes.Add("onchange", "alert('hello,world')");

 

in MultiStore by (120 points)

1 Answer

0 votes

Hmm, Scott you might have to use the outputted ID not the ASP.Net control ID (basically what the ASP.NET renders out with a funky/longer ID where that is part of it)?

Thank you,
Jan
 
Compunix, LLC (Phoenix, AZ)
AspDotNetStorefront Development Partner and Reseller since 2005
------------------------------------------------------------------------------------------------------
 AspDotNetStorefront add-ons and plugins : http://www.ecommercecartmods.com
 Complete Automotive Solution : http://www.autopartsshoppingcart.com
------------------------------------------------------------------------------------------------------
by (6.9k points)
...