Last post Jul 21, 2008 10:19 AM by JamesManhattan
Jul 12, 2008 05:23 AM|JamesManhattan|LINK
Someone please give me a run down on how to add databound fields to Classifieds Online Kit.
For instance; add fields: Color, Length, Manufacturer, Condition...
I created database fields in "Ads" table and I'm stuck with PostAd.aspx page. Can't figure out how to pull in a field that would post back to database.
I updated (InsertAd) Store Procedure, scripted field (Color) in PostAd.aspx. Tested, and the new field is not posting. What's missing?
It has to be a better way.
Three days later and there’s no answer, which turned out to be one thought question, sorry boys for testing your limits.
Jul 14, 2008 11:37 AM|darkknight187|LINK
It's bright and sunny here in Washington, so good luck getting any help from me on the weekend.
I've gone through it many times, so take a look at this post.
To get answers faster try doing an advanced search, usually someone has already gone through the same issue.
Jul 15, 2008 09:44 AM|JamesManhattan|LINK
I hear you Daniel, Washington state should be nice this time of the year. Here in Stockholm, Sweden rains every day and it gets colder than I thought it would. I’m on a business
trip and in the morning while the office in New York is closed I entertain myself with programming Classified Ads. The kit is been offer to download for two years, if not longer and now I seem to have the time and purposes to make something of it. If works
will serve local equestrian Swedes who seem to have a problem exchanging specialized products. I was pleasantly surprise when found out that the most desirable breed in Sweden is our American Quarter-horse, and everything else that goes with.
Back to adding a field – your advise was very helpful in pointing the flow. I checked and edited: tables, views, stored procedure. In App_Code I edited Ads.xsd, after that
had some twelve error messages coming for BLL, Ads.vb.
I fixed some, run Debug and I’m left with two error messages pointing to adType.
What am I missing?
Pages open as should but when I enter data to update that one field there is no post back and no error message either.
Here is the debugging error message.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
Jul 15, 2008 03:04 PM|JamesManhattan|LINK
Ok it's working – new field takes data and posts back to database, just as it should.
I made it into a dropdown list and it’s working like a charm.
It took a while to remember that asp.net splits the code of a page - had also to edit the code behind. PostAd.aspx and PostAd.aspx.vb go together but ...vb was the last to
I will have more questions on related topics but on this one I’m satisfied, case closed.
Thank you Daniel, you were a great help.
The real solution though is further down on post 13.
Editing the code beding - in postad.aspx.vb not needed.
Jul 15, 2008 06:08 PM|darkknight187|LINK
Glad to hear you got it.
Just don't forget, now that you have had a decent update, make a dated backup.
I can't tell you how many times I thought I had everything working right, and my new update caused an error elsewhere.
So backup, backup, backup. . . .
Jul 17, 2008 04:39 PM|JamesManhattan|LINK
Question on “ShowAd.aspx”;
After scripting-in, the field “Color” I get an error message – this one;
I know what it means, but where is that AdsDataComponent+AdsRow?
One other question – Should I post this question here or make a new post?
I marked Resolved - new question might not get an answer from wizards.
About backups - you wrote, backup 3 or 4 times, I took 5
I went back few times but only to copy and paste App_Code. That worked out errors. However, after few rounds over few days, I went back all the way to first backup and that
help. By then I had a better perception of error solving and produced a clear result.
I realized I was overdoing with coding.
For instance, PostAd.aspx doesn’t need any coding other than inserting the new field, and updating one Stored Procedure.
Now the ViewAd.aspx is a little different, the data source is sorted through Business Logic Layer, BLL and once I figure how that works I should be done.
Jul 17, 2008 06:54 PM|darkknight187|LINK
DataBinding: 'AdsDataComponent+AdsRow' does not contain a property with the name 'Color'.
I know what it means, but where is that AdsDataComponent+AdsRow?
If you look in App_Code/DAL/Ads.xsd (just double click it)
It shows what you currently have in the tables, you either forgot or misspelled color.
The fix sounds like it lies in Ads.xsd
For the most part, make a new post when it's off topic.
I'd say you are still on topic.
And just a pointer but I did have to make small modifications to the code behind on postad.aspx.
Don't forget to check the repost ad feature, if the ad expires and they want to renew, it should be seamless for them.
Glad to hear you are getting it.
Just remember one step at a time.
Jul 18, 2008 02:41 PM|JamesManhattan|LINK
It sounds like you have it all figure out.
Could you run a description about how you did the adding of one field to PostAd.aspx?
Tables to stored procedures, to form and other steps in between and we might learn something – by the way, from the read count, five hundred people appear to be as interested
as I am.
Jul 18, 2008 10:11 PM|darkknight187|LINK
I am a very busy guy, and I don't have the time to go over it again.
See the link at the top, or go through the code page by page, I learned a lot doing it that way.
All I did is pick a column that was already in there and copied the way it was done.
One pointer is on postad.aspx.vb at the bottom you see a section (LoadPreviousAd) this is the area that loads when the ad is being reposted. Try changing the price textbox to this:
Are you stuck somewhere?
What's the issue?
Jul 19, 2008 04:12 AM|JamesManhattan|LINK
Inserting new field, error message
1 Too many arguments to 'Public Overridable Overloads Function InsertAd(MemberId As Integer, CategoryId As Integer, Title As String, Description As String, URL As String, Price As Decimal, Location As String, ExpirationDate
As System.Nullable(Of Date), DateCreated As Date, DateApproved As System.Nullable(Of Date), NumViews As Integer, NumResponses As Integer, AdLevel As Integer, AdStatus As Integer, AdType As Integer) As System.Nullable(Of Integer)'.
C:\Documents and Settings\customer\My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual Basic\VisualBasic\Classified Ads\App_Code\BLL\Ads.vb
It could be either but knowing for sure will tell me what I have to work with - that’s my stuck point.
Jul 19, 2008 02:42 PM|JamesManhattan|LINK
PostAd.aspx works until a new field is added.
Again the error comes from Ads.cs in BLL.
Is there a way to get past that limit?
Jul 19, 2008 09:23 PM|darkknight187|LINK
The Ads.esd in DAL doesn’t have to be edited because gets its settings for Stored Procedures.
Yes it does.
I don't know who told you it doesn't but does, and if you didn't, it would cause that type of error.
enter your new column "color" into the DAL table, save, right click on the background, and choose "view code"
It does use the stored procedures, but it's basically the middleman between them.
Note: there is two sections for Insert Ads.
And make sure you use the same order all the time.
For example, you entered color after adtype in Ads.vb, you need to keep that order in Ads.xsd code aswell.
Then it will work.
By the way, I'm going on vacation for a week and a half, starting tomorrow morning.
So I may not be able to respond depending on the area at Yellowstone.
Jul 21, 2008 10:19 AM|JamesManhattan|LINK
Not very complicated, ain’t it? Only cost me couple of days!