ObjectDataSource, DropDownList, etc.

P

Patrick Bates

I've been holding off on moving to ASP.NET because I couldn't program the
same way I did in VB6/ASP. Our existing apps are written using a 2- or
3-tier model, depending on how you look at it. The web pages all reference
a COM DLL which contained Classes for the Business Logic layer and Modules
for the Data Access Layer, then connected to MS-SQL on the backend.

So now we're trying to convert just one page of our application. We started
off using several ObjectDataSource to seed several DropDownList controls.
It worked to a degree, but it didn't provide us enough options (namely that
I needed to add an "Any" option to each DropDownList). Then we tried the
AppendDataBoundItems setting so we could manually add "Any". That works
fine for the initial page load, but when the PostBack fires when any
DropDownList is modified, the attempts to reseed the DropDownLists cause the
new items to be added at the end of both the "Any" and the previous data
load... not what we wanted.

So now I'm trying to use the CodeBehind so I can purge DropDownLists on
PostBack, add in the "Any" item, then access the Data Object to retrieve the
DataSet and write the results in as well.

Problem is, I can't figure out how to call/declare anything which will let
me access the Class and Functions of the DLL in the Bin folder.

Any suggestions greatly appreciated...
 
E

Erik Funkenbusch

I've been holding off on moving to ASP.NET because I couldn't program the
same way I did in VB6/ASP. Our existing apps are written using a 2- or
3-tier model, depending on how you look at it. The web pages all reference
a COM DLL which contained Classes for the Business Logic layer and Modules
for the Data Access Layer, then connected to MS-SQL on the backend.

If anything, ASP.NET is *MORE* capable of 2 or three tiered work than
classic ASP is.
So now we're trying to convert just one page of our application. We started
off using several ObjectDataSource to seed several DropDownList controls.
Ok.

It worked to a degree, but it didn't provide us enough options (namely that
I needed to add an "Any" option to each DropDownList).

I don't understand why. Just have your data object generate the Any entry.
Then we tried the AppendDataBoundItems setting so we could manually add "Any".

That's a complicated solution to a simple problem.
That works
fine for the initial page load, but when the PostBack fires when any
DropDownList is modified, the attempts to reseed the DropDownLists cause the
new items to be added at the end of both the "Any" and the previous data
load... not what we wanted.

That's because you're using ViewState. Either use ViewState, and don't
reload the controls on postback, or don't use viewstate and load them every
time.
So now I'm trying to use the CodeBehind so I can purge DropDownLists on
PostBack, add in the "Any" item, then access the Data Object to retrieve the
DataSet and write the results in as well.

You're making this WAY too complicated.
Problem is, I can't figure out how to call/declare anything which will let
me access the Class and Functions of the DLL in the Bin folder.

I really don't understand what you mean. Are you using ASP.NET 1.1? I
assume so, since there isn't a bin folder (usually) in ASP.NET 2.0. If so,
your code behind is already being accessed, so your comment doesn't make
much sense to me.
 

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,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top