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

More Help With C# Code

Options
  • 29-01-2008 2:22am
    #1
    Registered Users Posts: 325 ✭✭


    Hi

    Im using C#, VS2005 and MySQL

    Here is what I am trying to do:

    Your on a page called "Town Hall" and theres a button there that you click called "Rate This Accommodation".

    This than brings them to the "Rating" page, they choose there ratings for the different things, than they click the "Save" button.

    I need this to than save into the "Town Hall" table.

    Than if someone was on the "Central Accom" page they go through the same steps as above but when they click save I need it to save it into the "Central Accom" table from the same Rating page.


    From advice given to me from elsewhere on these forums I have set up a Query String for both the pages above but I'm not sure what Im supposed to put in the Rate page so it looks at these Query Strings and decides by their value which table to put the data into.

    Can someone please give me some help?


Comments

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


    Ok,

    I suggested using a RadioButtonList in the last post so we will use that

    On your TownHall page (TH.aspx) have a link to to your ratings page (rating.aspx)

    Link it like so rating.aspx?Type=T&ID=1 where Type is the type of rating such as acc or townhall and ID is the ID of the item you want to rate.

    In your Rating page use the Page load event to check the type in the querystring

    Use that type to set the label text values so that you can have any type of rating you like

    eg (Pseudo)
    
    switch(TypeID)
    
    case "T"
    lblType = "Please rate this Town Hall"
    
    case "S" 
    lblType = "Plase rate this Student Accom"
    
    case else
    lblType = "Dont mess with my query sting fool!"
    
    

    Store the Type and IDs as vars in the page for later use. The user rates the thing and then clicks submit (or you have enabled AutoPostBack)

    Using the Page load event again (same one as above) you check to see if its a PostBack

    eg (Pseudo)
    
    void PageLoad
    
    If(Page.IsPostBack)
    {
     //Do stuff when the user submits
    }
    
    //Do stuff here that happens anyways such as labels set up
    
    

    On the postback check to see what type of insert you are doing , and then insert the values to to the appropriate table

    Its a simple as that

    Links for things in this post

    PostBack http://msdn2.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspx
    RadioButtonList http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.radiobuttonlist.aspx
    AutoPostBack http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.checkbox.autopostback(VS.80).aspx


  • Registered Users Posts: 325 ✭✭doyler442


    Cheers for the help - I managed to get it working there awhile ago


Advertisement