Where's the code?!

S

Scott M.

I am an experienced .NET 1.1 developer, but am just now looking at .NET 2.0
with Visual Studio 2005 Professional (SP1). I set up a basic ADO .NET ASP
..NET Web Application project and added a SQL Express database, an
application data source (to that SQL DB) and then dragged my SQL table onto
a blank ASP .NET WebForm and got a DataGridView created automatically. I
run the page and everything (including editing/deleting/paging) works fine -
pretty slick!

So, I open up the "designer" code file (not my code-behind) to see the
generated code, and to my surprise, all I see in this file are the object
instantiations for my page controls, but none of those controls underlying
code.

Where is the automatically generated code that make controls with designers
work so that I can look at, and possibly tweak the code?

-Scott
 
L

Lit

might have created file for you in the App_Code folder if you have one,
expand .xsd see all .cs codes ( all strongly typed dataset/table ??)
may or may not be what you are looking for.??

Lit
 
R

Rory Becker

Where is the automatically generated code that make controls with
designers work so that I can look at, and possibly tweak the code?

If you hit the "Show All Files" button in the solution explorer, you should
be able to see the additional files.

They are named things like MyForm.designer.vb and are nested under the main
files like RESX files would be.

Hope this helps
 
S

Scott M.

No, I have done that and, as I said, the code is not in the designer.vb
file, nor is it in the code-behind.

..resx files are resource files and will not contain VB .NET or C# code (only
..cs and .vb files will contain this).
 
S

Scott M.

Code for standard web forms do not go into the App_ folders, they are in the
same location as the main .aspx file (unless they have been manually moved).

..xsd files contain XML Schema data, not VB .NET or C# code.

Strongly typed DataSets are not .xsd files in the first place, they are .vb
or .cs files that contain VB .NET or C# code that defines the strongly-typed
DataSet class.

-Scott
 
L

Lit

When I dragged my table I got an xsd and some .cs files yes for a typed DS
also when I right click on where I dragged my table everything is
declarative. Table adapter etc.
stored procedure I want to use

Mine created an App_Code Folder??? what gives. depends on template?
No .cs code.
 
B

bruce barker

the code is in the controls themselves or generated by the controls at
runtime.

-- bruce (sqlwork.com)
 
S

Scott M.

So, are we back to the VB 6.0 days, when developers didn't get to see what
was actually happening behind the scenes and had to just trust that the
Microsoft generated code was optimized?
 
S

Scott M.

No .cs code.

That's my point. I'm not looking for the typed dataset code (.xsd's contain
no programming code, just XML and the .cs code you're getting is for the
typed DataSet only, not the TableAdapter). I'm looking for the TableAdapter
code. I'm looking for the underlying connection object's code. Where is
this stuff?
 
R

Rory Becker

So, are we back to the VB 6.0 days, when developers didn't get to see
what was actually happening behind the scenes and had to just trust
that the Microsoft generated code was optimized?

Well you don't get the source to the dotNet runtime BCL(base class library)
if that's what you mean.

However you can reverse engineer it with Reflector to examine it if you want.

Platforms where people can change the basic code in the runtime and recompile
lead to systems where each program might need to ship a copy of the runtime.
I can't tell you how many programs screwed each other over shipping different
versions of MFC42

The dotnet runtime ( for each version) is universally consistent with any
other copy. This is what makes it useful.

If you need to modify behavior you can *generally* override a class or 2
and alter the behavior in a descendant or set properties (either in code
or declaratvely)

I hope this helps
 
L

Lit

Scott,

No Code exists, that ^%$#@. It never fails that most of the time what is
given is not enough and I end up writing all the code from scratch.

Most of this Drag and drop and save 70% of code is good for Demos only.

It might work for some people but it just does not do it for me.



Lit
 
S

Scott M.

No, I'm not talking about the the runtime code. I'm talking about the
control's configuration code.

For example, in .NET 1.1 if I added a DataAdapter to my .aspx page and
configure it (either with the DataAdapter Wizard or via the properties
window), I'd see the control's VB .NET declaration, instantiation and
configuration in the code-behind. If I wanted to modify something, I could
just tweak the code there.

Now, in ASP .NET 2.0 all I see of the TableAdapter's code is one line in the
designer.vb file that declares the control. Where is all the code from me
configuring it via the various designers or the properties window?

-Scott
 
S

Scott M.

I've got no problem with generated code, as long as I can see it and modify
it as I need/want to. We had this capability in .NET 1.0/1.1, but now it
seems we have to either take the whole thing (and not really know what is
happening under the hood) or write everything from scratch!
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top