Groups | Blog | Home
all groups > asp.net > september 2006 >

asp.net : Formview control


dalholm NO[at]SPAM gmail.com
9/4/2006 11:32:24 PM
Hi, I'm just starting to poke around with asp.net, and have stumbled on
this problem:

I'm converting an old MS Access database to a web solution. I have
created individual user controls for each table, and added these to my
webpage. Now the master table "cars" has a usercontrol consisting
primarily of a formview and a accessdatasource. A car can be of a type
(bus, sportscar, etc.), data on the type is stored in the "carType"
usercontrol, which has also been added to the page.
Using me.session variables I the "carType" usercontrol is updated
whenever a new car is selected. However, and this is my problem: when I
on the "cars" usercontrol -> formview select "NEW" then I can't figure
out how to get then "carType" usercontrol to update, it still shows the
info for the previously selected car! On the "car" usercontrol ->
formview -> InsertTemplate I have added a dropdownlist listing
everthing in the "carType" table. But I can't trigger an update of the
"carType" usercontrol based on the value selected in this dropdownlist!

It seems, that whenever i can actually access the value of the
dropdownlist, then the "carType" usercontrol has already been
rendered...

Some guidance will be appreciated..

/Anders
Mark Rae
9/5/2006 12:00:00 AM
[quoted text, click to view]

Any particular reason for having an individual user control for each
table...?

Mark Rae
9/5/2006 12:00:00 AM
[quoted text, click to view]

But, by contrast, it sounds like all you've done is over-complicate it...

WebForms isn't like WinForms at all...

Mark Rae
9/5/2006 12:00:00 AM
[quoted text, click to view]

fromview modechanged ???

Mark Rae
9/5/2006 12:00:00 AM
[quoted text, click to view]

Sure, and don't take this the wrong way, but have you considered getting one
of the ASP.NET beginner's guide books and working your way through it...?
This is really good:
http://www.amazon.com/ASP-NET-Everyday-Apps-Dummies-Computer/dp/0764597760/sr=8-3/qid=1157445570/ref=sr_1_3/102-6908414-1018537?ie=UTF8&s=books

Nobody is born knowing this stuff, but it makes things so much easier if you
have a good basic grounding. If you get yourself into bad habits and
practices from the beginning, it can be really difficult to unlearn them...

As a jobbing contractor, I'm often called in to fix stuff, and I've seen
some horror stories in my time, though I must confess I've never seen an
ASP.NET app which has an individual UserControl for every table... :-)

dalholm
9/5/2006 12:03:49 AM

[quoted text, click to view]

lol... My initial reason was to keep it simple :D
dalholm
9/5/2006 1:18:50 AM
Maybe, this is also a learning process...

I think I have solved it if only I can fire a postback event on
fromview modechanged, any ideas

/Anders
dalholm
9/5/2006 1:55:20 AM

[quoted text, click to view]

modechanged doesn't work since it gets fired before the controls have
acutally been instantiated/loaded, if only...

I actually like the idea of the many usercontrols, since some of them
could potentially be used on other pages. And they are all pretty
selfcontained, only depending on the availability of a session
variable..

/anders
dalholm
9/5/2006 1:58:04 AM
It would actually seem that my only problem is making the session
variable available ahead of time...
AddThis Social Bookmark Button