Getting Error while using 2 and visual web developer 2005

Discussion in 'ASP .Net' started by Guest, Jun 15, 2005.

  1. Guest

    Guest Guest

    The below is error message :
    The type 'page2' already contains a definition for 'txtLocationName'

    i know why this comes. but iam not ablke to find the other place where the
    definition is added. coz iam not able to get this textbox object in the
    intellisence sp i tried to add a line "protected TextBox txtLocationName =
    new TextBox();" .. so i got this error. Plz help me on this

    thanks in advance
    Guest, Jun 15, 2005
    1. Advertisements

  2. Guest

    Brock Allen Guest

    In ASP.NET 2.0 when using codebehind ASP.NET generates a partial class to
    go along with your codebehind. This partial is where all your server side
    controls get declared for your codebehind. Without seeing your code, my guess
    is that in your codebehind (the one your working in, not the ASP.NET generated
    one) you've got the field declared. Just remove that line and you should
    be all set.

    As for the intellisense, it will eventually show up -- VS.NET will just need
    some time to catch up. Try to write the code anyway, and I'm sure it'll work.
    Just because it's not in intellisense doesn't mean it's not correct :)
    Brock Allen, Jun 15, 2005
    1. Advertisements

  3. Guest

    Guest Guest

    Ya u r right. i wrote the code and it worked. i deleted that line and itz
    okay ... can u tell me where can i find that code where all the controls are
    declared ... this is for my information. anyways thank u very much for ur
    prompt reply ...
    Guest, Jun 15, 2005
  4. Guest

    Brock Allen Guest

    The best way to see the generated code is to mark your code with debug=true
    then go to the ~/windows/ ASP.NETFiles/YourAppName/foo/bar/*.cs

    Essentially, they're under there with dynamically generated path names once
    you compile with debug=true.
    Brock Allen, Jun 15, 2005
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.