Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C# shopping basket, trying to remove an item...

1235789

Comments

  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    Ok, I've gone back to the start of the task here again. I've just taken your solution and have taken out all my Ajax menu and will try to start from scratch again and take smaller steps...


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    The smaller the step the easier to debug... :)


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    Here's the latest problem...

    Let's just forget about my own code for for a minute, the AJAX Drop down solution I've been using is available as a "boil in the bag/ready to go" solution from www.asp.net. So I went back there and just downloaded the solution from the site as it was before I fiddled around with it. All I'm trying to do is get this dropdown solution into the wider solution you gave me and even that can't be done using .net without a headache!

    I've been trying to do this using MS developer 2008 with your solution open in that environment and I've been getting stupid errors all week, all relating to the Ajax/dropdown part of the solution.

    Then I open the same AJAX solution using MS Developer 2005 and no problem whatsoever!

    Then I try to open your solution in MS Developer 2005 and I get another error that I've been getting there previously, that forced me to work on your solution using MS Developer 2008. Now that I've been using MS Developer 2008, I can't open my AJAX solution that is key to filtering the data I need to work...

    No matter what I try to do when using this framework, I feel like I'm standing on my head and p*ssing down upon myself!


  • Registered Users Posts: 2,790 ✭✭✭John_Mc


    Darragh29 wrote: »
    Here's the latest problem...

    Let's just forget about my own code for for a minute, the AJAX Drop down solution I've been using is available as a "boil in the bag/ready to go" solution from www.asp.net. So I went back there and just downloaded the solution from the site as it was before I fiddled around with it. All I'm trying to do is get this dropdown solution into the wider solution you gave me and even that can't be done using .net without a headache!

    I've been trying to do this using MS developer 2008 with your solution open in that environment and I've been getting stupid errors all week, all relating to the Ajax/dropdown part of the solution.

    Then I open the same AJAX solution using MS Developer 2005 and no problem whatsoever!

    Then I try to open your solution in MS Developer 2005 and I get another error that I've been getting there previously, that forced me to work on your solution using MS Developer 2008. Now that I've been using MS Developer 2008, I can't open my AJAX solution that is key to filtering the data I need to work...

    No matter what I try to do when using this framework, I feel like I'm standing on my head and p*ssing down upon myself!

    It's amusing the way you blame .net for everything, and not your lack of knowledge on how the framework works :)

    Post some error messages there and we should be able to help out


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    John_Mc wrote: »
    It's amusing the way you blame .net for everything, and not your lack of knowledge on how the framework works :)

    Post some error messages there and we should be able to help out

    Ah I know it's my lack of knowledge that is the problem here, I'm under no illusions about that, but I think if I'm trying to open a solution when I'm using Developer 2008 running on the 2.0 framework and I try to do the same thing with MS Developer 2005 runnning on the 2.0 framework, I didn't expect to have a problem!

    I'm sure you remember back when you started this, by virtue of the fact that you were inexperienced, you always think by default that the problem is something you've done in respect of a line of code or a statement or something, but not some stupid little issue that stops you successfully running a solution on two different development programs running on the same framework... Some of the errors I'm googling, others seem to be having the same issues and they are down to bugs in the application.


  • Advertisement
  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    John_Mc wrote: »

    Post some error messages there and we should be able to help out

    Right, here we go. I'm back using MS Developer 2005 and my AJAX Dropdown menu is working fine, so no issues there...

    I've tried to copy Gingers solution into this project and I'm getting one error that is a show stopper. I've done two screen shots to show the problem. This same problem last week led me to ditch MS Dev 2005 and jump to MS Dev 2008 and that got rid of this particular problem. Now I'm finding that my AJAX solution does work on MS Dev 2005 but not on MS Dev 2008. So I'm stuck with two development environments with one half of what I hope is a full solution working on each environment!


  • Registered Users Posts: 2,790 ✭✭✭John_Mc


    Darragh29 wrote: »
    Right, here we go. I'm back using MS Developer 2005 and my AJAX Dropdown menu is working fine, so no issues there...

    I've tried to copy Gingers solution into this project and I'm getting one error that is a show stopper. I've done two screen shots to show the problem. This same problem last week led me to ditch MS Dev 2005 and jump to MS Dev 2008 and that got rid of this particular problem. Now I'm finding that my AJAX solution does work on MS Dev 2005 but not on MS Dev 2008. So I'm stuck with two development environments with one half of what I hope is a full solution working on each environment!

    Google returned plenty of results for this. Check out this and see if it helps.


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Alrighty same error

    What is the folder path to the solution??? Full path

    Are you running this in the Inetpub\wwwroot directory if so, we need to make a virtual folder and make it into an application

    Additionally if you are running this in a folder that has many levels, check and see if there is a web.config in the folders above it


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    Right, that other error (ISS Virtual Folder), error has disappeared and now I have 4 different errors that I haven't seen before...


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    I see your issue now and why you are getting your problems

    you have 2 web projects there..

    The structure of that solution is incorrect

    You probably created a new website project and then added the projects that i made is that right??? You see how you have 2 app_code and app_data folders

    If you look at the solution in 2008 you will see that the Business, DataAccess and Common are all projects rather than folders which is the case in yours.

    To make this work with existing solution, I suggest that you use 2008 only.

    Add a reference in the ShoppingCartDemo project (the one that is highlighted in the picture)

    You can add the existing ASMX file to this solution (there could be an issue with namespaces) and you can also add the existing ajax.aspx file too.


  • Advertisement
  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    I think I need to pick one development program and stick to it, so here we go, it's MS Dev 2008. The other version is now in the bin...


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Easiest thing being honest


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    What I've done is I've taken the code from my Ajax.aspx and codebehind page and placed it into the empty Default.aspx page in Ginger's solution.

    I'm getting the following 4 errors when I do this. I haven't modifed the config.web file yet because when I did that before, I ended up generating a load of errors. I can't add an assembly reference into the project for System.Web.UI, when I click on "Add Reference", the above library isn't there when I try to add it, I'm wondering would this be the problem?


  • Registered Users Posts: 2,790 ✭✭✭John_Mc


    Darragh29 wrote: »
    What I've done is I've taken the code from my Ajax.aspx and codebehind page and placed it into the empty Default.aspx page in Ginger's solution.

    I'm getting the following 4 errors when I do this. I haven't modifed the config.web file yet because when I did that before, I ended up generating a load of errors. I can't add an assembly reference into the project for System.Web.UI, when I click on "Add Reference", the above library isn't there when I try to add it, I'm wondering would this be the problem?

    Think you need to add references to System.Web.UI and System.Web.UI.Extensions.

    You should be able to browse to it if its not listed


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    Ginger wrote: »
    Easiest thing being honest

    Buy a solution I think!


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    John_Mc wrote: »
    Think you need to add references to System.Web.UI and System.Web.UI.Extensions.

    You should be able to browse to it if its not listed

    That's cleared those 4 errors but generated another 8. I'm obviously missing a reference somewhere that exists in MSD 2005 but not in MSD 2008. I'm starting to get my head around the problem...


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    I'll just have to pick my way through the solution in both environments and see what is in 2005 that is missing in 2008 in terms of assembly references...


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Can you post the code in default.aspx.cs (ie the codebehind file) so I can see whats happening


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Also you need to add your Cars.asmx as a web reference for your web project


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    Ginger wrote: »
    Also you need to add your Cars.asmx as a web reference for your web project

    I'd say this is my problem. I have 8 errors but the last one below I think is the cause of all the others... here's my codebehind page:


    using System;
    using System.Web.UI;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Web.Services;
    using System.Collections.Specialized;
    using AjaxControlToolkit;

    public partial class _Default : System.Web.UI.Page
    {

    protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
    {
    // Get selected values
    string make = DropDownList1.SelectedItem.Text;
    string model = DropDownList2.SelectedItem.Text;
    string color = DropDownList3.SelectedItem.Text;

    // Output result string based on which values are specified
    if (string.IsNullOrEmpty(make))
    {
    Label1.Text = "Please select a make.";
    }
    else if (string.IsNullOrEmpty(model))
    {
    Label1.Text = "Please select a model.";
    }
    else if (string.IsNullOrEmpty(color))
    {
    Label1.Text = "Please select a color.";
    }
    else
    {
    Label1.Text = string.Format("You have chosen a {0} {1} {2}. Nice car!", color, make, model);
    }
    }

    [WebMethod]
    [System.Web.Script.Services.ScriptMethod]
    public static CascadingDropDownNameValue[] GetDropDownContentsPageMethod(string knownCategoryValues, string category)
    {
    return new CarsService().GetDropDownContents(knownCategoryValues, category);
    }


    }


  • Advertisement
  • Registered Users Posts: 2,931 ✭✭✭Ginger


    First off

    Right click on the ShoppingCartDemo project (the fourth one in the solution) and click add web reference and add Cars.asmx (that will remove part of the issue) and then add it with a using command

    Second bit, you are missing a namespace so

    using System;
    using System.Web.UI;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Web.Services;
    using System.Collections.Specialized;
    using AjaxControlToolkit;

    namespace ShoppingCartDemo
    {


    public partial class _Default : System.Web.UI.Page
    {

    protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
    {
    // Get selected values
    string make = DropDownList1.SelectedItem.Text;
    string model = DropDownList2.SelectedItem.Text;
    string color = DropDownList3.SelectedItem.Text;

    // Output result string based on which values are specified
    if (string.IsNullOrEmpty(make))
    {
    Label1.Text = "Please select a make.";
    }
    else if (string.IsNullOrEmpty(model))
    {
    Label1.Text = "Please select a model.";
    }
    else if (string.IsNullOrEmpty(color))
    {
    Label1.Text = "Please select a color.";
    }
    else
    {
    Label1.Text = string.Format("You have chosen a {0} {1} {2}. Nice car!", color, make, model);
    }
    }

    [WebMethod]
    [System.Web.Script.Services.ScriptMethod]
    public static CascadingDropDownNameValue[] GetDropDownContentsPageMethod(string knownCategoryValues, string category)
    {
    return new CarsService().GetDropDownContents(knownCategoryValues, category);
    }


    }
    }


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    After I changed the namespace line, 7/8 of the errors disappeared so there's only 1 left...

    The type or namespace name 'CarsService' could not be found (are you missing a using directive or an assembly reference?)

    You can see my Web reference on the screenshot below. Do I just call it up with:

    using CarsService;

    ???

    I've done this but still have the 1 remaining error so I'm wondering am I calling it up correctly with using CarsService; ???


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Ok, the second error is usually that the application hasnt being compiled...

    The first one, you need to change it to using localhost; because that is the name of the reference


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    I've changed the name of the web reference to CService and changed the line in the codebehind page to:

    using CServce;

    But still have the 1 error....

    There is an option to help binding the CarsService and it has changed the using CService; to using ShoppingCartDemo.CService;


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    This was the problem here:

    public static CascadingDropDownNameValue[] GetDropDownContentsPageMethod(string knownCategoryValues, string category)


    I had to change it to...

    public static ShoppingCartDemo.CService.CascadingDropDownNameValue[] GetDropDownContentsPageMethod(string knownCategoryValues, string category)


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    You can probably remove the ShoppingCartDemo.Cservice and replace it with a using ShoppingCartDemo.CService


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    Ginger wrote: »
    You can probably remove the ShoppingCartDemo.Cservice and replace it with a using ShoppingCartDemo.CService

    I tried that and it came back with an error saying there was an ambigious reference between two methods so I tried adding in the ShoppingCartDemo. and all is working grand now...

    I had to add enableEventValidation="false" Into the first line in my aspx page because I was getting this error, but when I changed enableEventValidation="false" to enableEventValidation="true", the solution worked grand...

    So now I have the two parts I need in my solution, here comes the hard part!!! :D:D:D


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    Just wondering should I be trying to get these two solutions into the same aspx file before trying to do any further with this???


  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    Am nearly there with this. Ginger you'll never have to buy a pint in Dublin again if this works for me! :D;):D


  • Advertisement
  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Good to hear, Dublin is wickedly cheaper than here anyways... is it coming along ok?


Advertisement