problem to insert value in dropdownlist on formView control

Lior Levy <[email protected]> Mon, 15 Sep 2008 20:28:22 +0300
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <[email protected]>
=20

Hello,

I'm using the SqlDataSource to insert value in dropdownlist, but i want =
to add a -- Add New -- at the end of the
list, but can't find a way to make it.

=20

It works very well if I delete the SqlDataSource of the DropDownlist...=20

maybe the inserted item is overwrited by the SqlDataSource !!?

=20

protected void FormView1_ItemCreated(object sender, EventArgs e)

    {

        if (FormView1.CurrentMode =3D=3D FormViewMode.Insert)

        {

            DropDownList dropDownList1;

            dropDownList1 =3D =
(DropDownList)FormView1.FindControl("DDL_ca");

            if (dropDownList1 !=3D null)

            {

                dropDownList1.SelectedIndexChanged +=3D new =
EventHandler(DDL_ca_SelectedIndexChanged);

                SqlDataSourceActions.ConnectionString =3D =
"ConnectionString";

=20

                dropDownList1.Items.Add(new ListItem("Add New1", =
"999"));

                dropDownList1.DataSourceID =3D "SqlDataSourceActions";

                dropDownList1.DataValueField =3D "CA_code";

                dropDownList1.DataTextField =3D "CA_desc";

                dropDownList1.DataBind();

                dropDownList1.Items.Add(new ListItem("Add New2", =
"999"));

            }

        }

    }

=20

Any Ideas?

=20

=20

=20


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This list is hosted by DevelopMentor=AE  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com