Won't update dataset with new dropdownlist values

Discussion in 'ASP .Net' started by Geoff, Sep 22, 2004.

  1. Geoff

    Geoff Guest

    I have a Webform with 2 dropdownlists and 2 text fields for the date. No
    matter what I select in the drop downlist, when I hit the submit button the
    data always comes up with the original values that were in the dropdownlists
    however the date parameters are accepted. The dropdownlist also go back to
    their original values instead of maintaining the values selected. My submit
    code is as follows:
    SqlDataAdapter1.SelectCommand.Parameters("@varSD").Value =
    DateTime.Parse(fld_SD.Text)

    SqlDataAdapter1.SelectCommand.Parameters("@varED").Value =
    DateTime.Parse(fld_ED.Text)

    SqlDataAdapter1.SelectCommand.Parameters("@varSN").Value =
    Int32.Parse(lst_Store.SelectedValue)

    SqlDataAdapter1.SelectCommand.Parameters("@varRN").Value =
    Int32.Parse(lst_Report.SelectedValue)

    SqlDataAdapter1.SelectCommand.Parameters("@varUno").Value =
    Request.Cookies("ckusername").Value

    SqlDataAdapter1.Fill(Ds_crdata2)

    UltraWebGrid1.DataBind()
    Geoff, Sep 22, 2004
    #1
    1. Advertising

  2. Geoff

    Curt_C [MVP] Guest

    how/where are you populating the DDL's? Try throwing a if(!IsPostBack)
    around it

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    Site: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "Geoff" <> wrote in message
    news:veh4d.164$...
    >I have a Webform with 2 dropdownlists and 2 text fields for the date. No
    > matter what I select in the drop downlist, when I hit the submit button
    > the
    > data always comes up with the original values that were in the
    > dropdownlists
    > however the date parameters are accepted. The dropdownlist also go back to
    > their original values instead of maintaining the values selected. My
    > submit
    > code is as follows:
    > SqlDataAdapter1.SelectCommand.Parameters("@varSD").Value =
    > DateTime.Parse(fld_SD.Text)
    >
    > SqlDataAdapter1.SelectCommand.Parameters("@varED").Value =
    > DateTime.Parse(fld_ED.Text)
    >
    > SqlDataAdapter1.SelectCommand.Parameters("@varSN").Value =
    > Int32.Parse(lst_Store.SelectedValue)
    >
    > SqlDataAdapter1.SelectCommand.Parameters("@varRN").Value =
    > Int32.Parse(lst_Report.SelectedValue)
    >
    > SqlDataAdapter1.SelectCommand.Parameters("@varUno").Value =
    > Request.Cookies("ckusername").Value
    >
    > SqlDataAdapter1.Fill(Ds_crdata2)
    >
    > UltraWebGrid1.DataBind()
    >
    >
    Curt_C [MVP], Sep 22, 2004
    #2
    1. Advertising

  3. Geoff

    Geoff Guest

    How easy. I was populating the DDLs in the page load event. I just added:
    "If Not (IsPostBack) Then" at the beginning of the page load event.
    Thanks!

    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > how/where are you populating the DDL's? Try throwing a if(!IsPostBack)
    > around it
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > Site: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "Geoff" <> wrote in message
    > news:veh4d.164$...
    > >I have a Webform with 2 dropdownlists and 2 text fields for the date. No
    > > matter what I select in the drop downlist, when I hit the submit button
    > > the
    > > data always comes up with the original values that were in the
    > > dropdownlists
    > > however the date parameters are accepted. The dropdownlist also go back

    to
    > > their original values instead of maintaining the values selected. My
    > > submit
    > > code is as follows:
    > > SqlDataAdapter1.SelectCommand.Parameters("@varSD").Value =
    > > DateTime.Parse(fld_SD.Text)
    > >
    > > SqlDataAdapter1.SelectCommand.Parameters("@varED").Value =
    > > DateTime.Parse(fld_ED.Text)
    > >
    > > SqlDataAdapter1.SelectCommand.Parameters("@varSN").Value =
    > > Int32.Parse(lst_Store.SelectedValue)
    > >
    > > SqlDataAdapter1.SelectCommand.Parameters("@varRN").Value =
    > > Int32.Parse(lst_Report.SelectedValue)
    > >
    > > SqlDataAdapter1.SelectCommand.Parameters("@varUno").Value =
    > > Request.Cookies("ckusername").Value
    > >
    > > SqlDataAdapter1.Fill(Ds_crdata2)
    > >
    > > UltraWebGrid1.DataBind()
    > >
    > >

    >
    >
    Geoff, Sep 22, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Hnatt
    Replies:
    2
    Views:
    2,743
    softsan
    Jul 24, 2007
  2. TSA
    Replies:
    1
    Views:
    711
  3. Larry Bud

    Formview update--one field won't update

    Larry Bud, Jul 11, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    383
    Larry Bud
    Jul 11, 2007
  4. Filip De Backer

    dataset values in a dropdownlist

    Filip De Backer, Apr 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    171
    Brock Allen
    Apr 12, 2005
  5. Replies:
    1
    Views:
    219
Loading...

Share This Page