Code Behind editor - C# vs. VB

Last post 01-06-2009 1:07 PM by tweaver60. 2 replies.

Sort Posts:

  • Code Behind editor - C# vs. VB

    01-06-2009, 11:59 AM
    • Member
      22 point Member
    • tweaver60
    • Member since 01-06-2009, 11:37 AM
    • Posts 67

    I am new to ASP.NET.  Started new website with VB, but ran into limitation of FormView/Linqdatasource with null dates for backend DB. apparently a problem assign a null to a datatime in VB code........... but not the problems I'm having here.

    So I recreated the site in C#, my first C# project, but I'm having problems with event routines in the codebehind editor.  I'm trying to right a FormView Updating Event to head off the above problem mention, But I have a couple of issues

    1. the event declaration/creation inside the code is not automatic like in VB - in the left side dropdown in VB, all the controls are listed out - in C#, only the main ASPX page is listed - and on the right dropdown in VB all the event are listed and can be created select the control in the first dropdown, then selecting the event in the secondl, but in C#, all the items are grayed out.
    2.  if I manually create the event routine, my intellisense doesn't work the way I am expecting when looking for properties/methods for the FormViewPageEventArgs e
         protected void FormPersonDetail_PageIndexChanging(object sender, FormViewPageEventArgs e)

        {    }

         but when I try to use the e.NewValues - the NewValues is not present, only a small list is there including cancel,Equals,GetHashCode,GetType,NewPageIndex,ToString

    Hence, I can program the event properly.

     

    ANY HELP WOULD BE APPRECIATED - I love ASP.net, but am very frustrated as a begining user,

    Thanks

     

  • Re: Code Behind editor - C# vs. VB

    01-06-2009, 12:05 PM
    Answer
    • All-Star
      86,764 point All-Star
    • ecbruck
    • Member since 12-30-2005, 7:39 PM
    • Des Moines, IA
    • Posts 9,209
    • Moderator
      TrustedFriends-MVPs

    In C#, there are really only two ways to add an event handler. The first is by simply adding it manually to the code-behind, and the second is to add it via the Designer window. If you click on a certain control within the Designer window and then click on the events button within the Properties window, you can double-click on any event which will then automatically add the event handler for you.

    As far as your other problem goes, I'm not sure why you lost your intellisense for this class. Usually closing and re-opening Visual Studio will do the trick.

    Thanks, Ed

    Microsoft MVP - ASP/ASP.NET

  • Re: Code Behind editor - C# vs. VB

    01-06-2009, 1:07 PM
    • Member
      22 point Member
    • tweaver60
    • Member since 01-06-2009, 11:37 AM
    • Posts 67

    Thanks Ed - that did the trick - apparently when the event handler is created automatically when clicking the event in the properties windows, it sets up all the intellisense correctly!

     

    Thanks again!

    Tim

Page 1 of 1 (3 items)