Last post Oct 30, 2008 10:47 PM by darkknight187
Oct 28, 2008 07:50 AM|knkn|LINK
Im trying to add a phonenumber to the ads, but always get some kind of failure message, making me really angry. By reading the postings in this forum this issue seems to be solved, but i cant find it. Could someone please guide me to it or give me a explination
on how it should be done. Thanks!
Oct 28, 2008 01:13 PM|darkknight187|LINK
There is two basic methods, you can either make it part of the profile like first name, last name . . .
That the user enters when they register.
Or you can make it part of posting your ad.
If you need help on this, what method would you prefer?
Oct 28, 2008 09:35 PM|knkn|LINK
The second type, where the number is filled when posting an ad. Have you done this?
Oct 29, 2008 12:25 AM|darkknight187|LINK
Yes, I have done that.
You may see for yourself at my site www.detelli.com
It's a little bit of a process, with a lot of changes, they all work together.
So keep in mind that you will see errors until you are done with all the modifications.
First off and very very important. SAVE YOUR WORK.
And make a backup of your project, I recommend copying to a folder and date your backup in the folder name.
(Also note that the first time I did this, I copied the way the others where stored like AdType.)
And I am assuming that you are using VWD and VB as your code.
So to start the process, we will start with the database.
Type a new column name Phone
I used nvarchar(15) as the data type, and left the box checked for allow nulls.
Next we need to go into Views, still in database, I'll tell you when to leave.
Go into classifiedsView_Ads and check the box with your new phone column.
Now into the stored procedures, there's lot's here.
Most are pretty obvious how to add.
This one I changed a lot and you may not need to add anything here at all. I forget.
If you have a area that says SELECT * Then you do nothing
If it list after the SELECT you need to add.
Congratulations, you are done with the database modifications.
Now into App_Code/DAL/Ads.xsd
Add you phone name to the list, and go into properties.
If you had allowdbnull, then set as true,
DataType should be System.String
MaxLength should be 15
And set source as same name, Phone or whatever
Save, and right click not on anything just the background, choose view code.
Now it get's really interesting, I prefer to change this manually, as running the wizard I got errors.
So this is how you do it manually.
VERY IMPORTANT ! !
You need to make sure that when you are adding your new column, it is always in the same spot.
You need to copy the format of one of the other string data types,
and enter into all the sections, insert, relist, and update.
Note that some are multiples, for example there are two insert ads sections, just don't rush it.
One more major step, now into App_Code/BLL/Ads.vb
You should see errors where you need to add your addition
Again, Into Insert, relist, and update.
Set you ByVal as String.
And take note of the order you used in the last step, very important.
Now it will work, and you can take a break if you like.
The only thing left is to add to postad.aspx, and editad.aspx.
Which should speak for it self.
I think that's it.
And this same format would work for other additions, you just may need to use a different data type.
Oct 29, 2008 09:44 AM|knkn|LINK
[Phone] [nvarchar] (50) Allow nulls ,
[Location] [nvarchar] (50)
when finding the view state sadly i didnt find the phone...
Have I done wrong already?
Ps. Nice page!!
Oct 29, 2008 10:17 AM|darkknight187|LINK
Any .sql files you find are just scripts, they are only useful if you were NOT making any changes to the database.
Since you are adding a new column, the .sql files are useless for you.
When you are done building your site and ready to upload it online, you will need to use another program to create new scripts.
What you need to do is open VWD (Visual Web Developer), and click the tab on the right of the screen that says databases.
You should see two databases, one says something like ASPNETDB, this is for holding your members information.
And the other is your classifieds database, something like CLASSIFIEDSDB. Click the + to expand it.
You now see all that is the classifieds kit, to get into the database to make the new column like I was talking about before,
just double left click on on the table that holds all the info for the ads, Classifieds_Ads.
Now you are in the database itself, let me know if you need more assistance.
Oct 30, 2008 03:22 PM|knkn|LINK
Iwe maby done a miracle...
I have been playing with the code a lot trying to realize by your instructions... I think maby that it has worked, because now i get only three errors,
all indicating that the phone dosnt exist in the postad page and admin page....
So now my question is how to fix this probaly easy thing...
Oct 30, 2008 10:47 PM|darkknight187|LINK
The postads is easy, in the postads.aspx page you need to add a textbox to enter a phone number into.
On postads.aspx.vb you need to copy the way it's binding the other columns such as title would be a good one to mimic.
Note that there is two sections to add to on this page. (postads.aspx.vb)
The one at top is for when posting an ad for the first time,
and the one at the bottom is for when the user is using the relist ad option after it expired.
Not sure what could cause the issue in admin, what admin page are you seeing an error on?