C# Code-Behind Wierdness

10 posts, 0 answers
  1. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 01 Feb 2010 Link to this post

    I've been working with RadControls for about 6 months now using VB.NET.  I just started a new project and decided to use C# because I'm an old Java programmer and I miss it.  My issue is that the event handlers (e.g., [radcontrol1]_Load()) are not firing in the code-behind.  The only examples I've seen from Telerik put everything in the Page_Load(), which is very lazy programming. Can someone clue me in?  Is there a different syntax for event handling in C# than in VB (besides the obvious brackets, semicolons, case-sensitivity, etc.)?

    Thanks,
    Mark
  2. O'Man
    O'Man avatar
    34 posts
    Member since:
    Oct 2009

    Posted 02 Feb 2010 Link to this post

    Hello Mark,

    Why don't you try to wire the events on the markup of the page? I have reviewed some of the demo examples and noticed that most of them have a C# tab. There you can check the required wiring technique for this programming language.
    Although I have been using Telerik controls for a while, I have not noticed that "The only examples I've seen from Telerik put everything in the Page_Load(), which is very lazy programming." For example these demos do NOT use the Page_Load() approach:

    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/webmail/defaultcs.aspx
    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/webmailgrid/defaultcs.aspx
    http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx
    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx
    http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/sorting/defaultcs.aspx
    http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/paging/defaultcs.aspx
    ......

    I hope this helps,
    Oman















  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 02 Feb 2010 Link to this post

    The reason I do not put code in the presentation tier (aspx page) is separation of concerns.  The Model-View-Control design pattern has been Best Practice for 20 years for OOP developers not using Microsoft's paradigm, which has only just come around to MVC in the past year.  Putting business logic in the presentation tier is B-A-D programming; if you want to know why, google it.  Microsoft made its developers lazy with VB 3.0 and beyond, with drag-n-drop and no concern what code was actually being written or where it was being written.  It perpetuates that laziness today with Visual Studio's Designer.  Members of my development team use it and it drives me crazy having to debug their code.

    Cheers!
    Mark
  5. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 03 Feb 2010 Link to this post

    Okay, Visual Studio does not have the same Page controls support for C# that it does for VB.  With VB, the code-behind dropdowns list all the controls and all their public methods; with C#, it does not.  Even though I read somewhere in the past 24 hours that known methods will automagically be invoked (like radGrid1_Load(), e.g.), they aren't.  What I found is that you have to declaratively attach the control to the method (e.g., in the aspx: radGrid1 OnLoad="radGrid1_OnLoad") when using C# code-behind.

    Did I get this right?  More importantly, why isn't this mentioned anywhere in any of Telerik's documentation, even though C# is obviously its language of choice?

    Cheers!
    Mark
  6. O'Man
    O'Man avatar
    34 posts
    Member since:
    Oct 2009

    Posted 05 Feb 2010 Link to this post

    Hi Mark,

    I see that you are quickly getting into the specifics of C#. However if you find the markup as well as the code-behind wiring approaches not appropriate, then how do you suggest the events to be hooked? I am sure that C# developers will be glad to meet your recommendation. But I am not quite sure that this is the right forum for such type of communication.
    As to "More importantly, why isn't this mentioned anywhere in any of Telerik's documentation, even though C# is obviously its language of choice?" - can you point me to the article where C# is stated as preferred language. As stated in my previous post most of the help articles and examples, I have come into, have dedicated C# and VB sections.

    Cheers,
    Oman
  7. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 05 Feb 2010 Link to this post

    Oman,

    You are right about this not being the place to discuss this; it should have been in the Telerik documentation in the first place!  As for C# being the language of choice?  I think every single working example that has been made available to me during the past year was written in C#.  This has not been a problem because porting to VB is trivial.  However, I was at a loss for an entire day trying to figure out what I was doing wrong because Visual Studio was not displaying the controls and their methods in C# as it does in VB before I realized that VS does not support C# like it does VB, and it was not my fault.  Had this information been provided in the Telerik documentation (it is, after all, because I am using Telerik controls that I am using .NET instead of Java to begin with), we wouldn't be having this dialogue and I would have saved a day.

    Cheers!
    Mark
  8. O'Man
    O'Man avatar
    34 posts
    Member since:
    Oct 2009

    Posted 10 Feb 2010 Link to this post

    Mark,

    I understand your frustration with Visual Studio's quirks but I don't agree with your opinion that Telerik should document every quirk of VS 2008! Since the problem is not caused by their product I don't think it is fair to blame them. Actually from our communication so far I noticed that you tend to blame these guys for anything. You still haven't given me any links to "The only examples I've seen from Telerik put everything in the Page_Load(), which is very lazy programming." and "Even though C# is obviously its language of choice?".
    In addition maybe you can provide some links to other ASP.NET based 3-rd party components that have documented some of the VS quirks. 

    Thanks,
    Oman
  9. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 17 Feb 2010 Link to this post

    Oman, I don't have the time nor the inclination to meet your requests for "proof."  Nor have I "blamed" anybody for anything.  The only thing about which I have consistently complained is the lack of complete, accurate, downloadable API documentation for both client and server.  And I am not the only one who shares this opinion.  Do a search on "documentation" in a few of the forae.

    I supposed the real source of my frustration is diving into RadControls without knowing the .NET controls on which RadControls are based.  I came to this project from a Java background and RadControls Q3 2007 were already being used, but I could find no documentation for that version.  So I bought a developer's license with my own money, basically just to get a product with current documentation so I could progress with my project.  Unfortunately, I found the latest downloadable documentation was published 11/2008 and while helpful, was not fully compliant with the Q2 2009 version I purchased, and has since gone further out of date.

    I have pointed out numerous omissions and errors in the online documentation to the documentation people (via the on-page link) over the past 9 months, as well as posted numerous assumptions, omisssions, and errors in the PDF (11/2008) version.

    My guess is that Telerik would have substantially fewer posts in the forae if good API (not tutorial) documentation was available for download.  See the Java API, Perl API, Javascript API, and the jQuery API documentation for examples of the right way to do it.  God knows the .NET API documentation is not a model!

    Cheers!
    Mark
  10. O'Man
    O'Man avatar
    34 posts
    Member since:
    Oct 2009

    Posted 22 Feb 2010 Link to this post

    Hi Mark,

    Although I knew that no "proofs" would be present I agree with you that more comprehensive documentation is always welcome. I have been using the Telerik product for a while and have had some "hard" moments with some scenarios. However searching the forums, looking the examples and asking the telerik staff have almost always escaped me from the stuck. I don't know if i am lucky, but I am happy with the support these guys provide. And as far as i know I am not the only one.

    Regards
    Oman



  11. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 22 Feb 2010 Link to this post

    I have made no complaint whatsoever about the quality of the assistance the Telerik tech provide; they do an excellent job!  My point remains that they would not have to work so hard if we could find solutions ourselves aided by comprehensive documentation.  What few service tickets I have submitted have always been answered promptly and 90% of the time with a solution.  Searching the forum requires a bit of creativity; nevertheless, I agree that the answers and code examples given, if not on the money, are close enough to translate.  I have absolutely no problem with tech support.

    Cheers!
    Mark
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017