protected void BtnForeignKey_Click(object sender, EventArgs e) { if (DropDownList1.SelectedIndex >= 0) { int index = DropDownList1.SelectedIndex; localhost.Field selectedField = FieldList[index]; localhost.Service serviceObj = new localhost.Service(); int orgID = (int)Session["orgID"]; int objID = (int)Session["objID"]; localhost.Table[] tablelst = serviceObj.getTablesWithPrimaryKey(orgID, objID, selectedField.FieldDataType); lstOfTables = new List<localhost.Table>(tablelst); DropDownList2.DataSource = lstOfTables; DropDownList2.DataTextField = "TNameProperty"; DropDownList2.DataValueField = "ObjIDProperty"; DropDownList2.DataBind(); ViewState["foreignkey"] = lstOfTables; } //serviceObj.getTablesWithPrimaryKey((int)Session["orgID"], }