コード例 #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (ddl.SelectedIndex >= 0 && DropDownList1.SelectedIndex >= 0)
        {
            localhost.Service serviceObj = new localhost.Service();
            values = (List<localhost.Field>)ViewState["listOfValues"];
            listOfTables = (List<localhost.Table>)ViewState["listOfTables"];
            localhost.Table tableObj = listOfTables[ddl.SelectedIndex];
            localhost.Field fieldObj = values[DropDownList1.SelectedIndex];
            bool success = serviceObj.DeleteField((int)Session["orgID"], tableObj.ObjIDProperty, fieldObj.FieldIDProperty);
            if (success)
                Label1.Visible = true;
            else
                Label2.Visible = true;

            int OrgID = (int)Session["orgID"];

            localhost.Table[] array = serviceObj.GetTables(OrgID);
            listOfTables = new List<localhost.Table>(array);
            ddl.DataSource = listOfTables;
            ddl.DataTextField = "TNameProperty";
            ddl.DataValueField = "ObjIDProperty";
            ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
            ddl.DataBind();
            ViewState["listOfTables"] = listOfTables;
            values = null;
            DropDownList1.DataSource = null;
            DropDownList1.DataBind();
        }
    }