PDA

View Full Version : Object does not exist in the current context


Rey
10-17-2008, 01:44 AM
Howdy all.

Am getting the error the name XXX does not exist in the current context.

This is a VS2008 web application where I created an aspx file (newhire) and copied over the html portion of another file (asp based on using Advance Form Handler).

Up to now form compiled and displayed. However, I've now added an email function. And in the process of coding the c# function that builds the email message contents using stringbuilder I encountered this problem with many of the html checkboxes.

Actually I should state that I had a similar problem w/another html text field(txtRequestorEmail) and resolved that one using FindControl and casting to another textbox. And while I'm working around this problem w/the checkboxes again using FindControl I'd like to understand what causes the problem.

I've found that the designer file does NOT contain any reference to the html checkboxes, e.g. protected global::System.Web.UI.HtmlControls.HtmlInputCheckBox ed2;

And research via google has not surfaced how to cause designer file to be regenerated as I've tried adding a textbox to the html source code and dragging same obj from the tool box to design view and nothing. I've even tried deleting the aspx.designer.cs file and changing the CodeBehind statement to CodeFile so I could access the convert web file to application option. This did nothing but recreate the designer file I had just deleted and with no html checkboxes being added. I've gone so far as to add the txtRequestorEmail textbox to the designer file and so far it has been deleted - but am not directly referencing field just in case.

Would greatly appreciate some enlightenment on this problem considering that if I don't use the FindControl workaround that I will have to recreate the entire form and use aspx controls instead of html controls. Probably not bad idea just that it takes time and this project has been delayed by another higher priority project...

Thanks in advance,
Rey