views:

30

answers:

1

hi, in the modal pop up i am using detailsview control by default all the data would be shown in label. there will be an edit button down once the user clicks edit button all the lablel would be gone and text box and dropdown control should be present so that user can change the values and again update into database

looking forward for a solution. i dnt want to use sqlDatasource. i wanted it to do in .cs thank you

A: 

here is how to:

<EditItemTemplate>
    <asp:DropDownList ID="DropDownList1" runat="server" />
</EditItemTemplate>


protected void DetailsView1_DataBound(object sender, EventArgs e)
{

    if (DetailsView1.CurrentMode == DetailsViewMode.Edit)
    {
        DropDownList ddl = DetailsView1.FindControl("DropDownList1") as DropDownList;
        if (ddl != null)
        {

            ddl.DataSource = dataSource;
            ddl.DataBind();

        }
    }
}
Saar