Error after adding a textfield to a form: 'Registration_Form' does not contain a definition for 'urlAddress'

Hi,

I'm working on a little project, exploring VisualStudio 2005 and C#. I am currently updating a simple registration form: a few fields for username, password, email, etc.. I took the existing form and I am now trying to add a UrlAddress field so the user can put in a link to a personnal web site. I am using a HtmlTextInput control. Here's the line from the .Aspx file:

<

input id="urlAddress" style="width: 409px" runat="server"/>

And this is the code from the Code-Behind file executed by the submit button:

protected

void Register() {
    
User usr = null;
    
try {
        usr =
new User();
        usr.Add(
new AppSettingsReader().GetValue("DBConnectionString", typeof(string)).ToString(),
                    
this.username.Value, this.password.Value, this.lastname.Value, this.firstname.Value, this.email.Value, 
                   
this.urlAddress.Value);
        Response.Redirect(
"RegComp.aspx?Type=Tutor", false);
   
   
} catch (Exception ex) {
       
if (Trace.IsEnabled)
            Trace.Warn(ex.ToString());
    }
}

User is a business object from the Business Tier. There's also a Data Tier. Everything goes fine when I run the application. The user is correctly added to the database. However, I keep getting an error in the Code Editor everytime I try to run the web application saying 'Registration_Form' does not contain a definition for 'urlAddress'.

Anyone has an idea about what I could have done wrong???

Guillaume


Guillaume Morin
IT Engineering Student
-1
guigui
1/8/2007 10:26:06 PM
asp.net.web-forms 93655 articles. 4 followers. Follow

3 Replies
576 Views

Similar Articles

[PageSpeed] 55

Why did you use HtmlTextInput control instead of Asp:Textbox?

You see this error normally because you do not have your asp control declared/initialized in the code behind.

Hope this helps.

Regards,


N Shukla
Architect/Technical Lead
1
nikshukla
1/9/2007 8:48:41 PM

I am using HtmlTextInput because that's what was used for the other fields. I tried with an asp:Textbox and I get the same error. In fact, I got this error with every control I tried.

I tried declaring explicitly the control in the code behind file but I get a 'Registration_Form' already contains a definition for 'urlAddress'.

I looked in older projects I made using VS 2003 and I noticed there is some code generated by VS to declare the controls used in the page. In VS 2005, if I understood correctly, this code appears in a partial class located in a different file than the one I'm writting code in. However, I can't find the other file. Where should it be located?

Is it possible that when the source code was copied and given to me, the other part of the class would have been in a hidden file and I did not receive it?
If this is the case then I suppose I still have access to the other components because the partial classes I don't have are already compiled in an assembly.


Guillaume Morin
IT Engineering Student
1
guigui
1/10/2007 2:06:03 AM

It is in FormName.aspx.designer.cs file

Regards,


N Shukla
Architect/Technical Lead
1
nikshukla
1/10/2007 1:11:09 PM
Reply:

Similar Artilces:

'System.Web.HttpRequest' does not contain a definition for 'form'
Hello all. .NET 2.0 newbie here.... What I'm trying to do is learn how to use the LoadVars() in actionscript. Here is the .NET / C#/ html code  1 <form id="form1" runat="server"> 2 <div> 3 <% 4 if (Request.form("userName") == "Cameron") 5 { 6 Response.Write("&aspvar=it is You!"); 7 } 8 else 9 { 10 Response.Write("&aspvar=you are not Cameron&"); 11 } 12 13 %> ...

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

'System.Windows.Forms.DataGridView' does not contain a definition for 'databind' and no extension method 'databind' accepting a first argument of type 'System.Windows.Forms.DataGridView' could be foun
 Error    1    'System.Windows.Forms.DataGridView' does not contain a definition for 'databind' and no extension method 'databind' accepting a first argument of type 'System.Windows.Forms.DataGridView' could be found (are you missing a using directive or an assembly reference?) how to solve this Are you using a web applictaion or windows application. If web aplictaion then you should not use 'System.Windows.Forms.DataGridView'  Try using system.web.ui.control.datagridVikram www.vikramlakhotia.comPlease ma...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

Error 39 'System.Data.DataRow' does not contain a definition for 'Item'
for (i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) { categoryID = ds.Tables[0].Rows[i].Item["categoryID"]; name = ds.Tables[0].Rows[i].Item["name"]; string catID = Convert.ToString(categoryID); ///Change made by me ddlCategory.Items.Add(new ListItem(name, catID)); qry = "Select count(categoryID) from categories where active = 'True' AND parentID=" + categoryID + ""; countCategories = objDB.getScalar(qry);       i get this errorIf the going seems easy, You are going DownHill... I've got the solution what you have to ...

ERROR: 'object' does not contain a definition for 'methodName'
I have a class and a page. The class has a method called RetrieveImage(int idx). In the Page_Load event, I called the RetrieveImage(3). example: Page_Load() {   ImagePrint objImage = new ImagePrint();   objImage.RetrieveImage(3);} I get the error CS0117: 'ImagePrint' does not contain a definition for 'RetrieveImage'   what am I missing? any clue would be appreciated. I'm still stuck. Is your ImagePrint class in the same namespace as the Page class that is trying to use it? NC...   No. The ImagePrint is a class inside the App_Code directory under a ...

Error: 'Object' does not contain a definition for 'object__field'
The problem is as follows. I'm trying to reduce the number calls I'm making into the SalesForce API. Currently, I use 3 calls to obtain the fields I need from the Account Object.  Here are the three methods I'm using: private string getContactId(string selfServiceUserName)    {        QueryResult qr = null;         sfdc.QueryOptionsValue = new QueryOptions();        sfdc.QueryOptionsValue.batchSize = 1;        sfdc.Query...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

'''
Name: L Lachowsky Email: e2brutus_10atyahoodotcom Product: Firefox Summary: ''' Comments: why duddn this surprise me... I change default server from IE to Mozilla, and then i get error messages. well, shud I decide to not get on my computer with Mozilla..or shud I risk security breeches with IE....hmmm at least i can get on the internet with IE Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this fee...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

Error
Hi  I have not worked in ASP.NET for quite a few months now... and it really shows. Desinging new simple site - nicked some of my old code. I think I must have totally forgotten a few crucial bits here and there. Code below:<%@ Page Language="VB" AutoEventWireup="false" MasterPageFile="~/change_master.master" MaintainScrollPositionOnPostBack ="true" %> <asp:Content ID="mycontent" ContentPlaceHolderID="master_placeholder" Runat="Server"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </asp:Content>  Imports system.Diag...

Error Message CS0117: 'System.Web.UI.WebControls.DropDownList' does not contain a definition for 'Text'
I get this Error Message: ( CS0117: 'System.Web.UI.WebControls.DropDownList' does not contain a definition for 'Text' ) from my Register.aspx when I try to open it. I've added a DropDownList to the Register.aspx page and it throws me this (CS0117 Error message). Could use some help on this. Don't know where and how to correct this problem. If I remove the Dropdownlist and recompile the CustomersDB.cs file, and run the Register.aspx page again then it opens up. But as soon as I add the DropdownList I receive this (Error CS0117). Would appreciate any help. Thank You. TIA. Here is the co...

error in ''%'' operator
hi... friends    i got this error (Syntax error: Missing operand after ''%'' operator)below statement. dtBtnScr.DefaultView.RowFilter = "LOCATION_CITY'" + txtCity.Text.Trim() + "%'AND LOCATION_STATE '" + ddlState.SelectedValue + "%'AND UNIT_ID'" + txtUnitCode + "%'AND UNIT_NAME '" + txtUnitName.Text.Trim() + "%'";   thnax friends It thinks you are trying to use the modulo operator: %. Look at the RowFilter string after you build it ...you should see the prob...

error CS1579: foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator'
Hi,I tried samples on preventing javascript injection attacks tutorial(http://www.asp.net/learn/mvc/tutorial-06-cs.aspx) and while executing i am getting this error. d:\DotNet\MVCapplication\MvcApplication1\MvcApplication1\Views\Home\Index.aspx(23): error CS1579: foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator'Pls suggest me.   The problem is this line in the tutorial code: foreach (Feedback feedback in ViewData.Model) You either need to cast ViewData.Model ...

Web resources about - Error after adding a textfield to a form: 'Registration_Form' does not contain a definition for 'urlAddress' - asp.net.web-forms

Resources last updated: 11/28/2015 9:37:23 AM