Bug in VS2005 Beta 2?

J

John

Hi all,

I posted a question earlier regarding C# and accessing an objects events
from within the IDE:

Say a gridview is dropped onto a page:
If the page is VB, I can go to the code-behind and simply select the
gridview from the top leaft dropdown and then select it's associated events
in the dropdown to the right of it.

I can't do this if the page is in C#.

Am I missing something here or am I to know the correct syntax for event
coding if I'm to use C#?


Regards
John.
 
S

Scott Allen

What you describe is a feature that has never been available in C#.

Is that a bug? Perhaps. Some will say it is "language
differentiation", but it is a feature not available to C#, none the
less.

If you are using a code-behind CodeFile, there is no way to
automatically have those events appear for the *Page* just by
selecting something and clicking a mouse. AFAIK, you have to add
events like Page_PreRender by hand and by knowing the correct method
signature.

For controls like the GridView you can flip into designer mode and
bring up the Properties window for the GridView. Click on the
lightning bolt icon to view a list of available events for the
control, and double click the event you want to handle.

The IDE will automatically add an event handler in your C# CodeFile.
 
S

Scott Allen

Interestingly enough, Juan and I were just talking about code-behind
versus inline code.

If you use inline code instead of a CodeFile, and are viewing the APSX
source, you will get the drop down losts atop the text editing area
that allow you to add event handlers for the page and any controls on
the page - even in C#.

+1 for inlinde code.
 

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

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top