Combo box post back

Last post 07-08-2009 9:49 AM by Augi. 8 replies.

Sort Posts:

  • Combo box post back

    07-08-2009, 8:18 AM

    Hi,

    I have a page that is loaded with the following URL (i.e. with query strings):

        http://testserver/testapp/Entity/1234?Type=ABC&Category=DEF

    There is a combo box on the page and the combo box contains a list of dates.  If the user selects a date, I'd like to post back to the server with the selected date appended to the URL above.  For example:

        http://testserver/testapp/Entity/1234?Type=ABC&Category=DEF&Date=20090708

    I don't know how to do the post back (form, jquery, or ???) with the date appended to the original URL.  I would appreciate it if you could provide a high level description of how that could be accomplished.  Thank you.

  • Re: Combo box post back

    07-08-2009, 8:29 AM
    • Star
      9,462 point Star
    • kamii47
    • Member since 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 2,198
    Set Autopostback property to true and Bind a SelectedIndexchange even to combo box In that event do your desired thing
    Kamran Shahid
    Sr. Software Engineer
    (MCP,MCAD.net,MCSD.net,MCTS,MCPD.net[web])

    Remember to click "Mark as Answer" on the post that helps U
  • Re: Combo box post back

    07-08-2009, 8:38 AM
    • Participant
      1,238 point Participant
    • pankajgohel
    • Member since 08-20-2007, 1:07 AM
    • Ahmedabad , India
    • Posts 276

    Set AutopostBack="true" for the combobox.

    Thanks
    Pankaj Gohel

    Please Mark as Answer if you find the post useful.
  • Re: Combo box post back

    07-08-2009, 8:43 AM

    I'm using MVC.  Is there an AutoPostBack property in MVC? Thanks.

  • Re: Combo box post back

    07-08-2009, 9:01 AM
    • Participant
      1,238 point Participant
    • pankajgohel
    • Member since 08-20-2007, 1:07 AM
    • Ahmedabad , India
    • Posts 276

    in MVC what you are using r you using asp:dropdown cntrol or html control?

    Thanks
    Pankaj Gohel

    Please Mark as Answer if you find the post useful.
  • Re: Combo box post back

    07-08-2009, 9:02 AM
    • Contributor
      6,329 point Contributor
    • Augi
    • Member since 10-18-2008, 5:46 AM
    • Czech Republic
    • Posts 1,098

    There is no post-back in ASP.NET MVC. Probably you could submit form after selection of combo-box is changed:

    <select name="someSelect" onChange="form1.submit()">
    Don't forget to click "Mark as Answer" on the post that helped you.
  • Re: Combo box post back

    07-08-2009, 9:18 AM

    Pankaj, I'm using the HTML controls.

    Augi, is the onChange going to automatically append the selected date to the original URL?


  • Re: Combo box post back

    07-08-2009, 9:33 AM
    • Participant
      1,238 point Participant
    • pankajgohel
    • Member since 08-20-2007, 1:07 AM
    • Ahmedabad , India
    • Posts 276

    if you are using html control than Augi solution will work :)

    Thanks
    Pankaj Gohel

    Please Mark as Answer if you find the post useful.
  • Re: Combo box post back

    07-08-2009, 9:49 AM
    Answer
    • Contributor
      6,329 point Contributor
    • Augi
    • Member since 10-18-2008, 5:46 AM
    • Czech Republic
    • Posts 1,098

    dragon-fly999:
    Augi, is the onChange going to automatically append the selected date to the original URL?
    If you place combo-box into FORM element that uses GET method for posting, then the answer is yes Smile

    Don't forget to click "Mark as Answer" on the post that helped you.
Page 1 of 1 (9 items)